Tuesday, 23 November 2010

WordProcessingML

WordPocessingML or WordML is MS tool or mechanism or whatever you wanna call it for report generation.
It is completely free and simple to use.
One of the most important  features of  MS Word 2003 was support for XML. It' been a while since then and few months ago I had to search for a way to generate reports from within Java application. Well, yes there is excellent BIRT or Jasper Reports but I decided to use WordML.

It turns out easy to use
1. Create XML Schema document in you favorite text editor (or some IDE).
2. Create "seed" document template in MS Word and attach the XML Schema. Here is little bit tricky, because you have to manually align and adjust report elements, fields etc.
3. Run console (DOS) command and generate output XSLT file.
4. From Java code - generate XML with real data and apply XSLT file

And that's all.
You have XML report, which could be opened from Word and looks perfect with all formatting, styles etc ...
Basically you can generate report from whenever you want. I have implemented it from PL/SQL code also.

No comments:

Post a Comment