Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there OpenOffice.org export components for Delphi (non-OLE)?

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?

like image 814
mjn Avatar asked May 22 '09 13:05

mjn


2 Answers

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.

like image 58
mghie Avatar answered Oct 06 '22 20:10

mghie


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.

like image 1
Marco van de Voort Avatar answered Oct 06 '22 19:10

Marco van de Voort