How to generate XLS from Cocoon

XLS is the binary format used by Microsoft Excel spreadsheets. XLS can be produced by Cocoon, using a component called POI, itself an Apache project. For an example on how integrate this with Cocoon, see XLSSerializer.

A very good outline on why and how to use POI is available at xml.com, under Excel Reports with Apache Cocoon and POI, showing how to use XSL to generate the Gnumeric file. Note it does not use the XLSSerializer.

Bear in mind that the Cocoon will not "automagically" generate XLS - you still need to write an intermediate stylesheet to convert XML to the Gnumeric File Format used by POI.

Reader comments

  • Note that if you are planning to color your cells, you should be aware of the color limits in Excel - see http://www.mvps.org/dmcritchie/excel/colors.htm
  • It is also possible to call the POI/Hssf classes from flowscript. This can be used for limited
    processing/small spreadsheets (Complicated logic is better done in your own Java classes).
  • The JXTemplate generator is a powerfull tool for generation of excel spreadsheets. You have a rudimentary Gnumeric XML file as a template with JX directives. You can then use JX to fill your rows (using varStatus in jx:forEach). This is extremely handy in flowscript generated excel sheets.
  • No labels