If you want to use subroutines (as you should) then try passing parameters into your subroutines. The following code works for me. (Read: It does not produce any warnings or errors and the Excel file is properly formatted).
#!/bin/env perl use strict; use warnings; use Excel::Writer::XLSX; my $workbook = Excel::Writer::XLSX->new( 'mytest.xlsx' ); my $worksheet = $workbook->add_worksheet( 'testsheet' ); write_me( $workbook, $worksheet ); sub write_me { my ( $workbook, $worksheet ) = @_; my $text_format = $workbook->add_format( bold => 1, italic => 1, color => 'red', size => 18, font => 'Lucida Calligraphy' ); my $result = $worksheet->write( 'A2', "Text" ); print "my result = $result\n"; $worksheet->write( 'B3', "Hello Excel", $text_format ); }
In reply to Re^3: Excel::Writer::XLSX 0 byte outfile
by Mr. Muskrat
in thread Excel::Writer::XLSX 0 byte outfile
by doc1623
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |