Converting Between WordprocessingML and Other Formats
While it can be very easy to translate simple custom XML formats into WordprocessingML (as we saw with Example 3-1), the reverse is not usually true—at least not when you’re interested in preserving all aspects of a document’s formatting. The sheer size and complexity of WordprocessingML makes it a very daunting task to write a generic stylesheet for converting WordprocessingML documents into some other format. For that reason, we won’t include any actual examples in this section. We can, however, point to some existing work that’s being done in this area.
HTML
During the beta program for Office 2003, Microsoft released an XSLT stylesheet for converting WordprocessingML documents to HTML. At just under 4,000 lines long, this stylesheet is an impressive and enlightening look at processing Word documents in XML format. At the time of this writing, Microsoft has not yet released an updated version of the stylesheet. Fortunately, the stylesheet will largely work as-is—provided that you update a few of the top-level namespace declarations. You can find this stylesheet by searching for “wordml” at Microsoft’s download center (http://www.microsoft.com/downloads/search.aspx). It’s quite possible that an updated version of the stylesheet will be available by the time you read this.
Converting Word documents to PDF can, of course, be done using products like Adobe Distiller. However, another possible way to perform this conversion ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access