in reply to Using Spreadsheet::WriteExcel with mod_perl and Content-Disposition?
#!/usr/bin/perl -w ###################################################################### +# # # Example of how write to alternative filehandles. # # March 2001, John McNamara, jmcnamara@cpan.org # use strict; use Spreadsheet::WriteExcel; use IO::Scalar; # # Example 1. Write an Excel file to a string. # # Refer to the IO::Scalar documentation my $xls_str; tie *XLS, 'IO::Scalar', \$xls_str; my $workbook1 = Spreadsheet::WriteExcel->new(\*XLS); my $worksheet1 = $workbook1->addworksheet(); $worksheet1->write(0, 0, "Hi Excel!"); $workbook1->close(); # This is required # The Excel file is now in $xls_str. # If you write it to a new file remember to binmode() the filehandle. # # Example 2. Write an Excel file to an existing filehandle. # open TEST, "> mytest1.xls"; my $workbook2 = Spreadsheet::WriteExcel->new(\*TEST); my $worksheet2 = $workbook2->addworksheet(); $worksheet2->write(0, 0, "Hi Excel!"); $workbook2->close(); # # Example 3. Write an Excel file to an OO style filehandle. # my $fh = FileHandle->new("> mytest2.xls"); my $workbook3 = Spreadsheet::WriteExcel->new($fh); my $worksheet3 = $workbook3->addworksheet(); $worksheet3->write(0, 0, "Hi Excel!"); $workbook3->close();
# Untested tie *XLS => 'Apache'; my $workbook = Spreadsheet::WriteExcel->new(\*XLS);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Update: Provblem 'solved'
by one4k4 (Hermit) on Mar 20, 2001 at 18:22 UTC | |
by Anonymous Monk on Apr 14, 2009 at 14:06 UTC |