I'm personally not terribly familiar with the module in question, but based upon the documentation, there doesn't appear to be range support for the write method. However, you could implement the functionality you desire using nested loops. You could use row-column notation like:

$format = $workbook->add_format(border => 1); for my $row (0 .. 2) { for my $column (0 .. 3) { $worksheet->write($row, $column,'undef',$format); } }

or using A1 notation:

$format = $workbook->add_format(border => 1); for my $row (1 .. 3) { for my $column ('A' .. 'D') { $worksheet->write($column.$row,'undef',$format); } }

Note that Perl is smart enough to deal with alphabetic indices in a limited fashion using Auto increment and Auto decrement and the Range Operators.

As a side note, if you wish to link to a module on CPAN on PerlMonks, use the notation [mod://spreadsheet::WriteExcel]. See more information in What shortcuts can I use for linking to other information?.


In reply to Re: spreadsheet write excel border creation by kennethk
in thread spreadsheet write excel border creation by skywalker

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.