Question

For document exchange, I would like to generate OpenOffice.org text and spreadsheet documents. So far I have found export components which require OpenOffice to be installed, using OLE.

Are there already Delphi components available which can write native files for OpenOffice.org Writer or OpenOffice.org Calc?

Was it helpful?

Solution

It depends on how complicated your documents are, and how much effort you want to invest.

OpenOffice.org documents (starting with version 2 of OO.org) are files in the OpenDocument Format, basically zipped directories with a documented structure, containing various XML and support files. You can use for example the "Open Inside" command of 7-Zip to navigate the files like a directory.

That gives you at least the following options:

  • Write the code to output the documents yourself, the Delphi stream classes and compression support should be sufficient. This is obviously the most difficult way, but you would have everything under your control.

  • Save minimal documents as template files and add them to your application as external support files or even as embedded resources. When a file needs to be written you copy the template and edit the content.xml file in the root directory. This should be a lot easier, a way I would probably go to create for example a simple spreadsheet file with several sheets and columns of data.

  • If you already have the license or don't mind to pay for it, FastReport VCL supports "Open Document Format for Office Applications (OASIS) exports, spreadsheet (ods) and text (odt)". Maybe there are other reporting solutions as well, but FastReport is the one I'm sure of.

OTHER TIPS

FPC/Lazarus' fpspreadsheet component can directly write older Excel formats, and OOO can open them. If you need spreadsheets rather than textdocuments, it could be an option to see if it can be ported to Delphi.

In Lazarus I am use zexmlss component for export to ODS. This component for lazarus, delphi and builder. Only for spreadsheets. Formulas working fine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top