3

on this page in the release notes of jqgrid 3.7.2, i see:

Fix export url in export to excel method

but i dont see any other documention about jqgrid natively supporting export to excel.

I have an asp.net mvc site and i have always done this on the server side to generate an excel file.

Is this now possible out of the box from jqgrid. Are there any examples of how this works?

John Farrell
  • 24,673
  • 10
  • 77
  • 110
leora
  • 188,729
  • 360
  • 878
  • 1,366

4 Answers4

8

There are method excelExport in grid.import.js which do not really much. The function is not described on http://www.trirand.com/jqgridwiki/doku.php?id=wiki:import_methods but you can look at http://www.trirand.com/blog/?page_id=393/help/exceltrue-not-working-for-me/ to have a feeling how it work.

I also use ASP.NET MVC and WCF and make export to excel on the server side with respect of Open XML SDK 2.0 (see Creating Excel document with OpenXml sdk 2.0, how to export asp.net MVC detail view data to an excel file? or Strategy in exporting to Excel with formatting from ASP.NET?). Usage of Open XML SDK 2.0 gives you the most flexibility and you can produce a perfect Excel file which you need.

UPDATED: The answer provides demo project which shows how to implement the approach.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • i want to do this in javascript (not PHP version) – leora Jul 14 '10 at 10:43
  • therefore this feature of jqGrid is not really relevant for you and I recommended you to use Open XML SDK 2.0 or stay on other method which you currently you on the server side. – Oleg Jul 14 '10 at 10:57
  • 4
    Do you really want to create Excel document IN JAVASCRIPT??? It would be masochistic. – Oleg Jul 14 '10 at 10:58
  • agree with you point but i have a lot of cases where i dont care about formatting extra and want a quick way to export the data to excel and it seemed from the release notes that jqgrid supported it out of the box. – leora Jul 14 '10 at 13:37
  • For quick & dirty solution I can suggest http://stephenwalther.com/blog/archive/2008/06/16/asp-net-mvc-tip-2-create-a-custom-action-result-that-returns-microsoft-excel-documents.aspx. You can also create also very easy export to CSV. You can also use some commertial solutions. If you do find a way to do this with out-of-the-box features of jqGrid - OK! But I am very pessimistic. – Oleg Jul 14 '10 at 14:07
  • @Oleg: Please look at my [question here](http://stackoverflow.com/questions/6742567/export-to-excel-in-jquery-or-jqgrid) – AabinGunz Jul 19 '11 at 05:27
  • @Abhishek Simon: I am now in the vocation be in a hotel and have no time. The export in excel is not the feature of jqGrid JavaScript code. You should implement it **in your server code**. If you can use Open XML SDK I would recommend you to use it. – Oleg Jul 19 '11 at 05:35
  • @Oleg: Thanks, i too tried to explain it to my superiors that its a server side job, but they said it will be saved in clients machine so it must be done as part of js. Thanks anyways, correct me if I am wrong. Though the `.xml` format opens in excel :) – AabinGunz Jul 19 '11 at 05:39
0

There are few other paid alternates that supports export to excel, csv and pdf

PHP Grid Control http://www.phpgrid.org

Instant PHP Grid http://www.phpgrid.com

Azghanvi
  • 934
  • 10
  • 22
0

Here's a walkthrough of how to add an "Export to Excel" button to your jqGrid, which will write to a real Excel file.

http://www.codeproject.com/Articles/784342/Export-data-from-jqGrid-into-a-real-Excel-file

enter image description here

(Note that this only works if you're using Visual Studio, as it uses the Microsoft OpenXML libraries.)

Mike Gledhill
  • 27,846
  • 7
  • 149
  • 159
0

See Calling Excel Export from a custom button (javascript):

Once again - the open source lib does not contain a method to make a excel file, buyt only a method to call a already constructed one.

Please download the jqGrid PHP wrapper from here: http://www.trirand.net/download.aspx

Read the install instructions here : http://www.trirand.net/documentation/php/_2v20f82ru.htm

and and do a demo described here: http://www.trirand.net/documentation/php/_2v212tis2.htm

in order to have the build in export to excel

user4531
  • 2,525
  • 7
  • 30
  • 38
  • 1
    Just as a note jqGrid PHP wrapper is commercial. A PHP Single Developer License costs from $300 to $450. – Gab Oct 01 '12 at 15:41