简体   繁体   English

从jqgrid到.xlsx

[英]From jqgrid to .xlsx

I am trying to export from jqgrid to excel, I am using ASP.Net(NOT MVC). 我正在尝试从jqgrid导出到excel,我正在使用ASP.Net(NOT MVC)。 The deal is that I need the extension to be .xlsx not .xls 问题是我需要扩展名是.xlsx而不是.xls

I found this with .xls 我发现.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. 第一个答案提供了演示,该演示演示了如何使用Open XML SDK 2.0生成XLSX文件。 The method DataForExcel.CreateXlsxAndFillData generate the XLSX as stream. 方法DataForExcel.CreateXlsxAndFillData生成XLSX作为流。 Another part of the code from ExcelResult.ExecuteResult is oriented on ASP.NET MVC, but it's small and hopefully easy to understand. 来自ExcelResult.ExecuteResult的代码的另一部分基于ASP.NET MVC,但是它很小,希望很容易理解。 It sets just Content-Type , Content-Encoding and content-disposition parts in HTTP header of the server response. 它仅在服务器响应的HTTP标头中设置Content-TypeContent-Encodingcontent-disposition部分。 Then it uses stream.WriteTo (response.OutputStream); 然后使用stream.WriteTo (response.OutputStream); to fill the body of the response with the stream of XLSX results. 用XLSX结果流填充响应的主体。 In other words you could easy rewrite the code to use in in any ASP.NET application. 换句话说,您可以轻松地重写代码以在任何ASP.NET应用程序中使用。

The second one provide an example how I backend needed for jqGrid can be implemented in ASP.NET (not MVC). 第二个示例提供了一个示例,说明如何在ASP.NET(不是MVC)中实现jqGrid所需的后端。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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