Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Update: Provblem 'solved'

by one4k4 (Hermit)
on Mar 20, 2001 at 18:22 UTC ( [id://65690]=note: print w/replies, xml ) Need Help??


in reply to Update: Provblem 'solved'
in thread Using Spreadsheet::WriteExcel with mod_perl and Content-Disposition?

The code
# Untested tie *XLS => 'Apache'; my $workbook = Spreadsheet::WriteExcel->new(\*XLS);

Woohoo. Thanks all!

_14k4 - webmaster@860.org (www.poorheart.com)

Replies are listed 'Best First'.
Re^2: Update: Provblem 'solved'
by Anonymous Monk on Apr 14, 2009 at 14:06 UTC

    I am having a similar problem. I have a link on a report detailing some ticket information. That link should regenerate the same data as displayed on the page but as an excel spreadsheet that is passed to the user for download and not saved on the server.

    The link works, a download dialog appears to save the file but for some reason the file appears to be limited to around 400k in size ( a little under 4500 of the 9755 rows that should appear. When I change from a file handle to saving the file to the server it works fine, the problem only happens when it's a direct download. Any help you could offer would be great

        tie *XLS, 'IO::Scalar', \$xls_str;
        my $workbook = Spreadsheet::WriteExcel::Big->new(\*XLS);
        my $worksheet = $workbook->add_worksheet();
    
        # Hardcoded row and column fields
        $worksheet->set_landscape();
        $worksheet->set_row(0,30);
        $worksheet->set_column(0,0, 20);
        $worksheet->set_column(1,1, 20);
        $worksheet->set_column(2,2, 20);
        $worksheet->set_column(3,3, 20);
        $worksheet->set_column(4,4, 20);
        $worksheet->set_column(5,5, 20);
        $worksheet->set_column(6,6, 20);
    
        # Spreadsheet Formating
        my $format = $workbook->add_format();
        my $titleformat = $workbook->add_format();
        $format->set_bold(1);
        $titleformat->set_size(15);
    
        # Counters
        my $rowcount = 1;
    
        # loops for writing
        while ( my @row = $sth->fetchrow_array ) {
          my $row_ref = \@row;
          $worksheet->write_row($rowcount,0,  $row_ref);
          $rowcount++;
        } #end of loop
    
        $workbook->close();
    
        #my $size = (-s $xls_str);
        print "content: myfile.xls\r\n";
        print "content-disposition: inline; filename=myfile.xls\r\n";
        #print "content-length: $size\r\n";
        print "content-type: application/vnd.ms-excel\r\n";
    
        #local $/ = undef;
        #open (F, "<$xls_str");
        #  binmode(F); binmode(STDOUT);
        #  print <F>;
        #close(F);
        print $xls_str;
    

    in the above script if I replace

        tie *XLS, 'IO::Scalar', \$xls_str;
        my $workbook = Spreadsheet::WriteExcel->new(\*XLS);
    
    with
        my $filename = "myfile.xls";
        my $workbook = Spreadsheet::WriteExcel->new($filename);
    
    The file is saved to my server with the correct number of rows

    I believe the problem has something to do with IO::Scalar and/or an apache config but I'm a little lost as to what I could be missing

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://65690]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-19 06:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found