需要将 Excel 文件流式传输到 Web 客户端
我有一种将 SQL 查询转换为 DataView
的方法,现在我正在尝试将 DataView
转换为可以从 asp.net 站点流式传输的 Excel 文档。
我尝试生成 .csv 文件,但 Excel 会弄乱格式。 然后尝试了 OpenXML,它看起来超级慢。
我只需要写出一些基本的表格数据,以便可以在 Excel 中对其进行修改并重新导入。
I have a method that converts a SQL query into a DataView
and now I'm trying to convert a DataView
to an Excel document that can be streamed from an asp.net site.
I've tried generating a .csv file but Excel would mess up the format.
Then tried OpenXML it appears super slow.
I just need to write out some basic table data so it can be modified in Excel and re-imported.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要创建 Excel 文件,您可以使用 Infragistics Excel 引擎。这里有一个如何从数据表创建 Excel 文件的示例:http://help.infragistics.com/NetAdvantage/ASPNET/Current/CLR3.5/?page=ExcelEngine_Populated_a_Worksheet_from_a_DataSet.html
然后,您也可以从 Excel 文件格式再次加载数据。如果您想对此进行测试,则可以使用 NetAdvantage for ASP.NET 试用版(如果您还没有此功能):
http://www.infragistics.com/dotnet/netadvantage/aspnetdownloads.aspx
For creating an excel file you could use the Infragistics Excel engine. There is an example of how to create an excel file from a DataTable here: http://help.infragistics.com/NetAdvantage/ASPNET/Current/CLR3.5/?page=ExcelEngine_Populating_a_Worksheet_from_a_DataSet.html
You could then load the data again from the excel file format as well. If you want to test this you could do so with a trial of NetAdvantage for ASP.NET if you don't already have this:
http://www.infragistics.com/dotnet/netadvantage/aspnetdownloads.aspx