NAME
Excel::Template - Excel::Template
SYNOPSIS
First, make a template. This is an XML file, describing the layout of the spreadsheet.
For example, test.xml:
<workbook>
<worksheet name="tester">
<cell text="$HOME"/>
<cell text="$PATH"/>
</worksheet>
</workbook>
Now, create a small program to use it:
#!/usr/bin/perl -w
use Excel::Template
# Create the Excel template
my $template = Excel::Template->new(
filename => 'test.xml',
);
# Add a few parameters
$template->param(
HOME => $ENV{HOME},
PATH => $ENV{PATH},
);
$template->write_file('test.xls');
If everything worked, then you should have a spreadsheet in your work directory that looks something like:
A B C
+----------------+----------------+----------------
1 | /home/me | /bin:/usr/bin |
+----------------+----------------+----------------
2 | | |
+----------------+----------------+----------------
3 | | |
DESCRIPTION
This is a module used for templating Excel files. Its genesis came from the need to use the same datastructure as HTML::Template, but provide Excel files instead. The existing modules don't do the trick, as they require replication of logic that's already been done within HTML::Template.
Currently, only a small subset of the planned features are supported. This is meant to be a test of the waters, to see what features people actually want.
MOTIVATION
I do a lot of Perl/CGI for reporting purposes. In nearly every place I've been, I've been asked for HTML, PDF, and Excel. HTML::Template provides the first, and PDF::Template does the second pretty well. But, generating Excel was the sticking point. I already had the data structure for the other templating modules, but I just didn't have an easy mechanism to get that data structure into an XLS file.
USAGE
new()
This creates a Excel::Template object. If passed a filename parameter, it will parse the template in the given file. (You can also use the parse() method, described below.)
param()
This method is exactly like HTML::Template's param() method. Although I will be adding more to this section later, please see HTML::Template's description for info right now.
parse() / parse_xml()
This method actually parses the template file. It can either be called separately or through the new() call. It will die() if it runs into a situation it cannot handle.
write_file()
Create the Excel file and write it to the specified filename, if possible. (This is when the actual merging of the template and the parameters occurs.)
output()
It will act just like HTML::Template's output() method, returning the resultant file as a stream, usually for output to the web. (This is when the actual merging of the template and the parameters occurs.)
SUPPORTED NODES
This is just a list of nodes. See the other classes in this distro for more details on specific parameters and the like.
Every node can set the ROW and COL parameters. These are the actual ROW/COL values that the next CELL tag will write into.
WORKBOOK
WORKSHEET
IF
LOOP
ROW
CELL
FORMULA
BOLD
ITALIC
BUGS
None, that I know of.
SUPPORT
This is currently beta-quality software. The featureset is extremely limited, but I expect to be adding on to it very soon.
AUTHOR
Rob Kinyon
rob.kinyon@gmail.com
CONTRIBUTORS
There is a mailing list at http://groups-beta.google.com/group/ExcelTemplate
COPYRIGHT
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
SEE ALSO
perl(1), HTML::Template, Spreadsheet::WriteExcel.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 330:
=back doesn't take any parameters, but you said =back 4