Author Topic: Need help with Excel export  (Read 4746 times)

sbryan

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 6
    • View Profile
Need help with Excel export
« 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.
 

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Need help with Excel export
« Reply #1 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" });
« Last Edit: March 23, 2015, 04:22:43 pm by paramquery »

sbryan

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Need help with Excel export
« Reply #2 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.


« Last Edit: March 23, 2015, 08:57:11 pm by sbryan »

orendaw

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Need help with Excel export
« Reply #3 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?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Need help with Excel export
« Reply #4 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.