[dancer-users] Export To Excel

Kadir Beyazlı kadirbeyazli at gmail.com
Tue Sep 22 10:29:31 BST 2015


Hi Andrew,

On Mon, Sep 21, 2015 at 8:48 PM, Andrew Beverley <andy at 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 at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users



-- 
Kadir Beyazlı
Computer Engineer
GSM : +90 535 821 50 00


More information about the dancer-users mailing list