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? 2-) Is there any plugin for export at Dancer2 -- Kadir Beyazlı Computer Engineer GSM : +90 535 821 50 00
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 ;-)
2-) Is there any plugin for export at Dancer2
Hi Andrew, On Mon, Sep 21, 2015 at 8:48 PM, Andrew Beverley <andy@andybev.com> 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
2-) Is there any plugin for export at Dancer2
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
-- Kadir Beyazlı Computer Engineer GSM : +90 535 821 50 00
Hi Andrew, On Tue, Sep 22, 2015 at 12:29 PM, Kadir Beyazlı <kadirbeyazli@gmail.com> wrote:
Hi Andrew,
On Mon, Sep 21, 2015 at 8:48 PM, Andrew Beverley <andy@andybev.com> 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 dancer-users@dancer.pm 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
participants (2)
-
Andrew Beverley -
Kadir Beyazlı