简体   繁体   中英

From jqgrid to .xlsx

I am trying to export from jqgrid to excel, I am using ASP.Net(NOT MVC). The deal is that I need the extension to be .xlsx not .xls

I found this with .xls

Thanks

I can recommend you to examine the code (and download test projects) from the answer and another one . The first answer provide the demo which shows how to use Open XML SDK 2.0 to generate XLSX files. The method DataForExcel.CreateXlsxAndFillData generate the XLSX as stream. Another part of the code from ExcelResult.ExecuteResult is oriented on ASP.NET MVC, but it's small and hopefully easy to understand. It sets just Content-Type , Content-Encoding and content-disposition parts in HTTP header of the server response. Then it uses stream.WriteTo (response.OutputStream); to fill the body of the response with the stream of XLSX results. In other words you could easy rewrite the code to use in in any ASP.NET application.

The second one provide an example how I backend needed for jqGrid can be implemented in ASP.NET (not MVC).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM