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 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 <andre.w.fischer@sun.com>.