Language

The Free and Open Productivity Suite
Released: Apache OpenOffice 4.1.15

NAME

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


SYNOPSIS

    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.


DESCRIPTION

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:

title
The title of the page.

name
The name of the page.

threadid
The id of the thread.

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

colcount
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.

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

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


CUSTOMIZATION

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.


INTERNALS

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:

write_calc_content
write_column_styles
write_table_list
write_table
write_cell

Colors

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

Indentation

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


AUTHOR

Andre Fischer <andre.w.fischer@sun.com>.

Apache Software Foundation

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

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