Skip to main content
Windward

Placing your xml data in your Office template file

Overview

How to place your xml data in your Office template file.

Resolution

The Office 2007 files, DOCX, PPTX, and XLSX are actually zip files. Windward Reports supports using an XML file datasource that is in the Office 2007 file. Here is an example (more info here).
Version: 7.0

Creating the template with embedded data

  1. Create the file from_files.docx with the following text:
    Before
    Name: <wr:out select='/order/customer/name'/>
    After
  2. Close Word.
  3. Open from_files.docx in WinZip
  4. Add to the zip file customXml\item1.xml.
    Please note that Word requires this directory and file name. If you use a different directory, Word will delete the file. If you use a different filename, Word will rename it item1.xml.
  5. Add the following line to the relationships part (document.xml.rels) in the word\_rels folder: http://schemas.openxmlformats.org/officeDocument/2006/relationships..." Target="../customXml/item1.xml" />
  6. Close WinZip
  7. Open the file in Word, make an edit, save the file. This will add the files itemProps1.xml & item1.xml.rels to from_files.docx

Creating the report using the embedded data

  • In AutoTag select the XML datasource and for the filename enter (AutoTag can use the below engine "jar:..." naming too - but self: does this for the template you are in so you do not need to know the name and location of the template file)
    "self:customXml/item1.xml"
  • For the engine (java & .net) pass in a filename of (for .net you may use zip: instead of jar:)
    "jar:file:c:\from_files.docx!/customXml/item1.xml"

 

  • Was this article helpful?