rashley has asked for the wisdom of the Perl Monks concerning the following question:
I then feed the report back to the browser with the following function.
sub retrieveFile { my $file = shift; if(not -e $file) { croak "Could not locate file: $file)"; } if(not open(FH, $file)) { croak "Could not open file: $file"; } my $filesize = -s $file; print $cgi->header(-type=>'application/vnd.ms-excel', -Content-Disposition=>"attachment; filename +=$file", -Content_Length=>$filesize); while(<FH>) { print; } close FH; }
So when this is run, you get the standard "Open or Save" windows dialog.
If you choose "Save" and then open it, you get the dialog to apply the stylesheet. It opens in Excel and all is right with the world.
But if you choose "Open", you get the dialog, then an error message that says: "The download of the specified resource has failed.", then you get the stylesheet dialog AGAIN, then the file opens and looks fine.
Since the file is fine when you save, I don't see how the problem could be in the XML being generated, which means that the problem is in my Perl somewhere.
Any thoughts, please? Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Openning XML in Excel using CGI
by Joost (Canon) on Nov 29, 2006 at 15:55 UTC | |
by rashley (Scribe) on Nov 29, 2006 at 16:18 UTC | |
|
Re: Openning XML in Excel using CGI
by BaldPenguin (Friar) on Nov 29, 2006 at 16:38 UTC | |
by rashley (Scribe) on Nov 29, 2006 at 16:46 UTC | |
by BaldPenguin (Friar) on Nov 29, 2006 at 17:44 UTC | |
by rashley (Scribe) on Nov 29, 2006 at 18:33 UTC | |
by BaldPenguin (Friar) on Nov 29, 2006 at 22:39 UTC | |
| |
|
Re: Openning XML in Excel using CGI
by rashley (Scribe) on Dec 05, 2006 at 22:27 UTC |