I created a module that I've been using happily in house for generating
quick reports. It does a few things automatically and simplifies the
Spreadsheet::WriteExcel interface.
* Automatic Cell Width Adjustment based on text width
* Borders around all the data
Example:
my $report = Spreadsheet::Report::Basic->new({
title => 'My Simple Report',
filename => 'mysimple.xls',
alignment => 'portrait',
});
# Setup the Column Headers
$report->columnHeaders(
'ID',
'Date',
'Credit',
'Debt',
'Category'
);
# Add Data
$report->addRow(1, '2009-03-30', 0, 20.00, 'Grocery');
# Add a new format
$report->addFormat('credit', { color=>'green', bold => 1 } );
# Use that:
$report->custom_row( 'credit', 1, '2009-04-01', 2000.00, 0, 'Bank Error');
# Insert a blank row:
$report->blank_row();
The really "neat" part of the interface is the handling of the
reporting.
If you want to save it:
$report->WriteToFile( '/tmp' );
If you want to Email it:
$report->EmailReport({
to => '[email protected]',
cc => [ qw([email protected] [email protected]) ]
});
If you want to incorporate it into a website, and the person is
downloading the report:
my $c = new CGI;
$report->OutputToBrowser( $c );
There's also a multisheet capable version named
Spreadsheet::Report::Multi.
My question is, do you think the CPAN needs another spreadsheet module?
If so, is this set of modules aptly named?
--
Brad Lhotsky