hawtin has asked for the wisdom of the Perl Monks concerning the following question:
Fellow monks: I am getting some behaviour that appears impossible to me. I have a script that is producing an Excell spreadsheet as follows:
# Send the last table in a form that Excel can use my($quest) = @_; my $buffer = ""; my $fh = new IO::Scalar \$buffer; my $book = Spreadsheet::WriteExcel->new($fh); my $sheet = $book->add_worksheet("data"); my %formats; ...Removed Code adds some formats with calls like... foreach my $f (list_formats()) { my $format = $book->add_format(); $format->set_bg_color('yellow') if($f =~ /yellow/i); $formats{$f} = $format; } for(my $y=0;$y<=$#last_table;$y++) { for(my $x=0;$x<=$#{$last_table[$y]};$x++) { my $val = ${$last_table[$y]}[$x]; my $format_name = "cell"; ...Work out the format name... my $r; $r = $sheet->write_string($y,$x, $val,$formats{$format_name}); # $r = $sheet->write_string($y,$x, # "$y,$x: Test "."1234567890"x30, # $formats{$format_name}); } } $book->close(); return $buffer;
As written the resulting spreadsheet will not open in Excell. If I grab only the first 136 characters of the string it works, if I send a long string (as shown in the commented out section) it works.
I have dumped the $val text out and there are no wide characters in it (i.e. it only contains bytes in the range 0x20-0x7A. I have written the data directly to a file (rather than via an IO::Scalar) and it behaves the same.
What is going on? What have I missed?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Strange behaviour (Spreadsheet::WriteExcell)
by jmcnamara (Monsignor) on Feb 28, 2005 at 11:09 UTC | |
by hawtin (Prior) on Feb 28, 2005 at 11:36 UTC | |
by jmcnamara (Monsignor) on Feb 28, 2005 at 11:49 UTC | |
by Crian (Curate) on Feb 28, 2005 at 12:58 UTC | |
by hawtin (Prior) on Feb 28, 2005 at 14:51 UTC | |
by ff (Hermit) on Mar 01, 2005 at 13:23 UTC | |
| |
Re: Strange behaviour (Spreadsheet::WriteExcell)
by hawtin (Prior) on Feb 28, 2005 at 10:55 UTC |
Back to
Seekers of Perl Wisdom