Hi Monks!
I am trying to create Worksheets using Spreadsheet::WriteExcel module
The code is as follows
use Spreadsheet::WriteExcel
my $workBook = Spreadsheet::WriteExcel -> new ( "report.xls" );
foreach $file ( @files ) {
if ( ! ( ( $file eq "." ) || ( $file eq ".." ) ) )
{
#Create excel sheet for each testsuite.
my $workSheet;
$workSheet = create_excel ( $file );
write_excel ( $workSheet );
}
}
Here the array "@files" contains files in a directory
I am using a function create_excel to create an excel sheet and format the sheet
The function create_excel is as follows
sub create_excel {
my $name = shift;
my $worksheet = $workBook->add_worksheet( "$name" );
#my $format = $workBook->add_format ( border => 2, valign => '
+vcenter', align => 'center', bold => 1, );
#$format->set_bg_color('47');
#my $format1 = $workBook->add_format ( border => 2, align => '
+center', bold => 1 );
#$format1->set_bg_color('47');
#my $format2 = $workBook->add_format ( border => 2, valign =>
+'vcenter', align => 'center', bold => 1, );
#$format2->set_bg_color('42');
#$worksheet->set_column ( "C:C",40 );
#$worksheet->merge_range ( "C6:C8","TEST",$format );
#$worksheet->merge_range ( "D6:H6","RESULT",$format );
#$worksheet->merge_range ( "I6:N6","PAGES",$format );
return $worksheet;
}
I am using a function write_excel to write the data in the excel sheet
I am not able to do like this...
I am getting a blank excel sheet. There is no data written in it
Can anyone Help me on this is regard
Thanks in advance
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.