As part of my product development efforts I have had to create tabular data in
various formats PDF, XL and HTML.
I use Perl CGI and of course jQuery for my products.
So the CGI has to generate these from ...yes HTML.
But there is a difference.
The HTML that renders on a web page along with other HTML elements
inside a div is different
from a HTML page that contains just the desired table.
But it is rather easy.
Creating MS XL and PDF is a little more work.
It turns out I can use a Perl CPAN module Spreadsheet::WriteExcel can
do that job with some programming.
For HTML tables I use a UNIX command with htmldoc.
/usr/local/bin/htmldoc --webpage -t pdf14 --pagemode fullscreen --size
25x11in --left 2 -f out.pdf out.html
The code for Spreadsheet::WriteExcel goes along:
my $wb = Spreadsheet::WriteExcel->new("$outpath/webhistory.xls");
$w = $wb->add_worksheet("History of web traffic");
$b = $wb->add_format(); $b->set_bold();
$wcol = 0;
@h = ();
for(qw(Date From_IP URL HTTP_method Action)) {
$w->write(0, $wcol++, $_, $bold);
}
@rows = ();
$wrow = 1;
$wcol = 0;
# Write to an Excel file as well...
for($date, $host, $macid, $url, $method, $action) {
$w->write($wrow, $wcol++, $_);
}
$wrow++;
$wb->close();
-Girish
--
Gayatri Hitech
http://gayatri-hitech.com
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
ILUGC Mailing List Guidelines:
http://ilugc.in/mailinglist-guidelines