ParamQuery grid support forum

General Category => ParamQuery Pro Evaluation Support => Topic started by: sbryan on March 22, 2015, 05:36:42 am

Title: Need help with Excel export
Post by: sbryan on March 22, 2015, 05:36:42 am
Would it be possible to get a little more detailed information on what's required on the server side to implement the excel export?
I searched the forum and have looked at the demo and see the code to use on the server side but it doesn't explain much and seems to assume the user should know what to do with it and where it needs to go.

Any help in the right direction would be appreciated. We have a 2008 R2 server running PHP.
 
Title: Re: Need help with Excel export
Post by: paramvir on March 23, 2015, 04:21:06 pm
All server side interactions are based on simple GET and POST requests, you don't have to do any extra setup for this demo.

In export demo there are 2 requests, first one is POST request send by grid, $_POST['excel'] contains the Excel contents which can be temporarily saved in a session ( as shown in sample code ) or any other storage and server script is supposed to echo the filename after saving the posted contents.

In second $_GET['filename'] request, previous session is served as a downloadable file.

Just take care that url parameter in the below method points to PHP script on your server.
Code: [Select]
  $("#grid_export").pqGrid("exportExcel", { url: "/pro/demos/excel", sheetName: "pqGrid sheet" });
Title: Re: Need help with Excel export
Post by: sbryan on March 23, 2015, 08:35:54 pm
Thank you for the help.

I had tried this before posting the last message but I wasn't getting the prompt to save the file. It was as if it wasn't sending the post to the php script. After looking again at the sample and recopying the part that makes the export button, it now works. I'm not sure exactly where I screwed up before but am happy to have it working.


Title: Re: Need help with Excel export
Post by: orendaw on July 30, 2018, 11:26:46 pm
@paramQuery:

You mentioned this:
Quote
Just take care that url parameter in the below method points to PHP script on your server.

What if you do not use PHP? Is there an alternative server side method?
Title: Re: Need help with Excel export
Post by: paramvir on July 31, 2018, 08:19:34 am
It can be implemented in any server side language that supports GET / POST variables and json, which is true for all major server side languages/ frameworks.

In this example https://paramquery.com/pro/demos/export, code is provided for ASP.NET ( MVC ), PHP and J2EE.