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?


In reply to Strange behaviour (Spreadsheet::WriteExcell) by hawtin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.