Subject: | output() method fails on files > 7Mb |
The output() method returns undef for generated Excel documents that come out to >7Mb. The
write_file() method works fine.
Failing test attached (needs cleaning up to check that it's running with a version of
Spreadsheet::WriteExcel that can write large files).
Not massively urgent for me ATM. Got around it by monkey patching. Thought you should know
Cheers,
Adrian
PS And thanks for a trez useful module. Apart from this issue - it's saved me a bunch of time.
Subject: | big-xls.t |
#!/usr/bin/perl
use strict;
use warnings;
use Excel::Template::Plus;
use Test::More tests => 4;
my $excel_template = q{
<workbook>
<worksheet name="Test">
[% FOREACH row = [ 0 .. 3000 ] %]
[% IF row % 100 == 0 %]
<row><bold><cell>Row [% row %]</cell></bold></row>
[% ELSE %]
<row>
[% FOREACH col = [ 0 .. 50 ] %]
<cell>ROW [% row %], COL [% col %]</cell>
[% END %]
</row>
[% END %]
[% END %]
</worksheet>
</workbook>
};
my $template = Excel::Template::Plus->new(
engine => 'TT',
template => \$excel_template,
);
diag "generating with $template\n";
diag "writing file... this may take some time...";
my $file = 'write-file.xls';
$template->write_file( $file );
my $file_len = -s $file;
ok -e $file, "$file created";
ok $file_len > 0, "$file has length > 0 ($file_len)";
diag "fetching output... this may take some time...";
my $output = $template->output;
my $output_len = length $output;
ok defined $output, "we got some output";
is $output_len, $file_len, "same length output as in $file";