NAME
WWW::WebExcel - Perl extension for creating excel-files printed to STDOUT
SYNOPSIS
use WWW::WebExcel;
binmode(\*STDOUT);
# data for spreadsheet
my @header = qw(Header1 Header2);
my @data = (['Row1Col1', 'Row1Col2'],
['Row2Col1', 'Row2Col2']);
# create a new instance
my $excel = WWW::WebExcel->new();
# add worksheets
$excel->add_worksheet('Name of Worksheet',{-headers => \@header, -data => \@data});
$excel->add_worksheet('Second Worksheet',{-data => \@data});
$excel->add_worksheet('Test');
# remove a worksheet
$excel->del_worksheet('Test');
# create the spreadsheet
$excel->output();
## or
# data
my @data2 = (['Row1Col1', 'Row1Col2'],
['Row2Col1', 'Row2Col2']);
my $worksheet = ['NAME',{-data => \@data2}];
# create a new instance
my $excel2 = WWW::WebExcel->new(-worksheets => [$worksheet]);
# add headers to 'NAME'
$excel2->set_headers('NAME',[qw/this is a test/]);
# append data to 'NAME'
$excel2->add_row('NAME',[qw/new row/]);
$excel2->output();
DESCRIPTION
WWW::WebExcel simplifies the creation of excel-files in the web. It does not provide any access to cell-formats yet. This is just a raw version that will be extended within the next few weeks.
METHODS
new
# create a new instance
my $excel = WWW::WebExcel->new();
# or
my $worksheet = ['NAME',{-data => ['This','is','an','Test']}];
my $excel2 = WWW::WebExcel->new(-worksheets => [$worksheet]);
add_worksheet
# add worksheets
$excel->add_worksheet('Name of Worksheet',{-headers => \@header, -data => \@data});
$excel->add_worksheet('Second Worksheet',{-data => \@data});
$excel->add_worksheet('Test');
The first parameter of this method is the name of the worksheet and the second one is a hash with (optional) information about the headlines and the data.
del_worksheet
# remove a worksheet
$excel->del_worksheet('Test');
Deletes all worksheets named like the first parameter
add_row
# append data to 'NAME'
$excel->add_row('NAME',[qw/new row/]);
Adds a new row to the worksheet named 'NAME'
set_headers
# add headers to 'NAME'
$excel->set_headers('NAME',[qw/this is a test/]);
set the headers for the worksheet named 'NAME'
output
$excel2->output();
prints the worksheet to the STDOUT.
DEPENDENCIES
This module requires Spreadsheet::WriteExcel
BUGS
I'm sure there are some bugs in this module. Feel free to contact me if you experienced any problem.
ToDo
* add formats to cell * write spreadsheet into file * add data (rows) to worksheet * add headers to worksheet (replace the existing list) * widen range of headers (add headers to the existing ones) * widen range of data (add cols to data)
SEE ALSO
Spreadsheet::WriteExcel
AUTHOR
Renee Baecker, <module@renee-baecker.de>
COPYRIGHT AND LICENSE
Copyright (C) 2004 by Renee Baecker
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.1 or, at your option, any later version of Perl 5 you may have available.