Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^3: Excel-Writer-XLSX : Excel file with warning messages

by rajan (Acolyte)
on Oct 10, 2019 at 06:26 UTC ( [id://11107279]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Excel-Writer-XLSX : Excel file with warning messages
in thread Excel-Writer-XLSX : Excel file with warning messages

Dear Friends: Thanks for taking patience in answering the question. I have the issue resolved like this but I am not sure how it works. Here is the code

my $subject="Monthly Report"; my $file_link="\n Dear Customer: Please click on the link below to dow +nload the Monthly Report for the month of 2019-05. <br><br> <a href=\ +"https://$hostname/ui_report/download_report?file=$fileloc\">Download + Report</a></center> \n\n"; # $fileloc contains the path of the store +d file in our server. &SendEmail($from,$toAddress,$cc,$bcc,$subject,'text/html',$file_link,$ +from); # This module sends an email with link - by clicking will down +load the excel report. In the "download_report" script: if ($file =~ /\.xlsx$/) { print "Content-type: application/vnd.openxmlformats-officedocument.spr +eadsheetml.sheet\n"; # The Content-Disposition will generate a prompt to save the file. print "Content-Disposition: attachment; filename=$file\n"; print "\n"; &download ($fileloc); exit 0; # NEWLY ADDED DUE TO ISSUE IN EXCEL REPORT OPENING } print "Content-Type: text/html\r\n\r\n"; my $cgi = new CGI; print $cgi->redirect("tent"); print "The redirect seems to have failed."; die;

By simply adding "exit 0; " statement I am able to download and view the report without any warnings. I believe previously after the execution of if block, it continued the execution and it might have created the problem. Please let me know if my explanation is not sufficient.

Above

Replies are listed 'Best First'.
Re^4: Excel-Writer-XLSX : Excel file with warning messages
by poj (Abbot) on Oct 11, 2019 at 10:24 UTC
    it continued the execution and it might have created the problem

    Yes, adding Content-Type: text/html to the end of the downloaded file.

    poj
Re^4: Excel-Writer-XLSX : Excel file with warning messages
by swl (Parson) on Oct 10, 2019 at 21:44 UTC

    I can only speculate that your email script is sending the link before the file is completely written, but the fact that it has all the content makes me think that is unlikely. Maybe you are using an older version of Excel::Writer::XLSX and it has been since fixed? (The change log does not indicate anything, though, and the git log has the most recent changes to the close() method at eight years ago).

    You also say you use scripts, which suggests you are calling them using system, exec or similar instead of loading code from .pm files. Maybe there is something in that.

    It is easier to diagnose issues if you provide a short, self contained, correct example.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2024-04-24 17:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found