XML to Word Conversion Demonstration
This note describes how to get MS-Word 2000 to read XML and automatically style it properly in Word. The Microsoft Office HTML and XML Reference you need to fully map most document constructs (lists, tables, headings, footnotes, document properties, cross-references, etc.) from XML to Word is available for download at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoffxml/html/ofxml2k.asp as a Compiled HTML Help file.
The secret of Word 2000 is that although it generates horrible pseudo-HTML/XML when saving Word documents as web pages, it can understand and correctly interpret well-formed XML documents which conform to its own Word schema (described in the Office Reference). Word XML is essentially XHTML, with some, but surprisingly few, chunks of embedded XML, which use the MS-Office or Word namespaces.
You can try out our online HTML to Word converter, to see the XML that Word understands. The generated file is XML, even though it has a .doc extension.
All the files are available in this small Zip file. xml2word.doc looks like a Word file, and will probably open automatically in your browser window if using MS-IE5. It is really a well-formed XML file, exactly the same as xml2word.xml. Save either file locally and view in a plain text or XML editor. This will let you see the XML markup used by Word. These files should open OK in Word 2000, 2002 (XP) and 2003, in any language edition. Note: (Apr 03) The XML declaraton has been removed from the files, as it seems to prevent Word 2002 and 2003 from interpreting them.
To see the styles used in Word, click on the paragraph or character markup you want to check, and look at the style dropdown menu just underneath the File menu. The B, I, or U icons in the formatting toolbar may also be highlighted. To see all paragraph styles in a left pane, go to Tools>Options>View, and set the 'Style area width' to be 1 inch.
If you would like us to develop XSLT stylesheets to convert your XML content back into Word, please feel free to call us for a quote. Note that once in Word, you can easily re-convert back to XML again using our very own product, YAWC Pro, or a range of other good Word/RTF to XML converters, such as UpCast or Logictran. This approach offers almost complete round-tripping between Word and XML, allowing you to edit in either or both formats, depending on the needs/skills/environment of your authors.