The Free and Open Productivity Suite
Apache OpenOffice 4.1.6 released


LogFile::XML - Perl module for writing creating an OpenOffice Calc document.


    use LogFile::XML;
    write_calc_document ("test.sxc",
        { name => "table-name",
          data => [ ["first row", 1],
                    ["second row", 2],
                    ["third row", 3]
          ] } );

will generate a XML file readable by the OpenOffice Calc that consists of one page named ``table-name'' containing a table consisting of two columns and three rows.


Generates a XML file in OpenOffice Calc format. The file contains a zipped collection of three files: META-INF/manifest.xml, meta.xml, and content.xml.

A call to write_calc_document is passed the name of the zip file to create and a data structure that contains the data to be written in Calc XML format. This data structure is a reference to an array of data tables. Each data table is written as a distinct Calc page and has to contain the following elements in a hash reference:

The title of the page.

The name of the page.

The id of the thread.

A prefix given to all XML names. With this table specific styles can be referenced.

the number of columns in the resulting table.

widths (optional)
A reference to an array of column widths. They widths have to be specified by numbers that give the widths in centimeters.

A reference to an array of column descriptions. The number of descriptions may be different from colcount.

The actual data, an referenced array of array references. This specifies a two-dimensional array arranged in rows and then in columns.


The variables $ZipCmd and $ZipFlags are required to contain the name of the executable binary of the zip program and a set of suitable arguments. They are initialized from the environment variables LOG_FILE_ZIP_CMD and LOG_FILE_ZIP_FLAGS respectively. If the environment variables are not set then the values ``zip'' and ``'' are used as a default.


The functions tag, enter, and leave provide easy means of writing correctly nested and indented tags with arbitrary arguments.

The manifest is taken care of if you create it with create_manifest, add all files making up the document with add_file and finally write it with write_manifest.

Files are created with open_file relative to a temporary directory. When the script terminates the temporary directory together with all files in it, is deleted.

The special files meta.xml and manifest.xml are written with the functions write_meta and write_manifest.

The actual calc document is written with a cascade of functions:



You can change the backround colors of cells by changing the values of the variable %Color.


The indentation is specified by the string in $IndentationString which defaults to two spaces.


Andre Fischer <>.

Apache Software Foundation

Copyright & License | Privacy | Contact Us | Donate | Thanks

Apache and the Apache feather logo are trademarks of The Apache Software Foundation. OpenOffice, and the seagull logo are registered trademarks of The Apache Software Foundation. Other names appearing on the site may be trademarks of their respective owners.