You
might have to add
binmode(XLS);
before you start creating the spreadsheet. But that's probably not what's causing the problem you're seeing.
The WriteExcel documentation suggests using "-" to designate STDOUT.
print header("application/vnd.ms-excel");
binmode(STDOUT);
my $wb = SpreadSheet::WriteExcel->new("-");
...
If that's not sufficient, you might need to add the header
Content-Disposition: attachment; filename=text.xls
(Also suggested by an example in the WriteExcel.pm docs.)
Update: You've probably already tested this, but does the machine on which you're running the browser have Excel installed, and will the browser invoke Excel for normal .xls files?
Update 2: Ignore all of this until you've resolved the problem tye identified below.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.