Hi Andrew,
On Tue, Sep 22, 2015 at 12:29 PM, Kadir Beyazlı <[email protected]> wrote: > Hi Andrew, > > On Mon, Sep 21, 2015 at 8:48 PM, Andrew Beverley <[email protected]> wrote: >> On Sun, 2015-09-20 at 16:16 +0300, Kadir Beyazlı wrote: >>> Hi All, >>> >>> I have a data listed with html table. >>> When I click on o a button, I want data to be exported to excel. >>> With CGI.pm I do it in 2 ways >>> >>> 1-) when clicked on button, redirect to a sub and use >>> Spreadsheet::WriteExcel module >>> 2-) no need to another sub, change header if clicked on button >>> >>> #set cmd to export when clicked on button and perform POST reques >>> if ($q->param('cmd') eq 'export') { >>> print $q->header( >>> -content_type => "application/vnd.ms-excel", >>> -attachment => Report."-$stamp.xls", >>> ); >>> } >>> >>> I have 2 questions: >>> >>> 1-) I can apply 1st method at a new route. If I try 2nd method, how >>> will I change header? >> >> Something like: >> >> return send_file( >> \$content, >> content_type => 'application/vnd.ms-excel', >> filename => "filename.xls", >> ); >> >> It goes without saying that given recent developments you should >> consider using Open Document Format instead ;-) > [KB] I will try and inform you as early as possible, thanks >> [KB] As I read from tutorial, send_file returns a file which already exists. It does not create a new file with new content. I solved my problem by using core Perl method using Spreadsheet::WriteExcel module which is the method I am using at my CGI.pm web projects :) Thanks >>> 2-) Is there any plugin for export at Dancer2 >>> >> _______________________________________________ >> dancer-users mailing list >> [email protected] >> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users > > > > -- > Kadir Beyazlı > Computer Engineer > GSM : +90 535 821 50 00 -- Kadir Beyazlı Computer Engineer GSM : +90 535 821 50 00 _______________________________________________ dancer-users mailing list [email protected] http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
