Recently, I've run into some strange behavior when I use formats with multiple books. It seems that formats applied to subsequent books do not have any effect. Here's a simple case showing the behavior:
use strict; use Spreadsheet::WriteExcel; { my $workbook = Spreadsheet::WriteExcel->new("one.xls"); my $north = $workbook->addworksheet("one"); my $format = $workbook->addformat(); $format->set_bold(); $north->write(0, 0, "One -- this should be bold", $format); } { my $workbook = Spreadsheet::WriteExcel->new("two.xls"); my $north = $workbook->addworksheet("two"); my $format = $workbook->addformat(); $format->set_bold(); $north->write(0, 0, "Two -- this too should be bold", $format); }
In this example, each spreadsheet lives in its own scope, so they should not interact. What happens in this example on my machine that the format (in this case, bold) does not have any effect on the second sheet. This is true for more complicated formats, applied to more cells, etc, but this is a minimal case showing the behavior.

Anyone have any suggestions? Am I missing something here? Thanks!

In reply to Spreadsheet::WriteExcel - using formats with multiple books by nop

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.