导出 XML -> Excel
我已经生成了一个包含 2 个工作表的 Excel XML 文件 (.xml)。
问题#1:
下载 XML 文件的人不知道如何在 Excel 中打开该文件。 (他们会抱怨。)
解决方案#1:
我将文件重命名为 .XLS 而不是 .XML。
问题 #2:
在 Excel 中打开文件时出现此错误:
The file you are trying to open, ‘XXX.xls’ is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file.
解决方案 #2:
以某种方式将 XML 文件转换为 XLS 文件。
所以这就是我向您求助的地方...
目标:
他们需要能够通过双击文件来打开该文件。 我不想使用某些第三方库重建 Excel 文件。
想法:
也许使用如下工具将 XML 转换为 xls:
http://npoi.codeplex.com/
http://excelpackage.codeplex.com/
我需要一些实现此目的的最简单和 LITEst 方法的示例代码。
还有其他想法吗?
I'm already generating an excel XML file (.xml) containing 2 worksheets.
issue #1:
the people downloading the XML file wouldn't know to open the file in Excel. (they'd complain.)
solution #1:
I rename the file to .XLS instead of .XML.
issue #2:
when opening the file in Excel i get the this error:
The file you are trying to open, ‘XXX.xls’ is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file.
Solution #2:
Convert the XML file to XLS file somehow.
so here's where i turn to you...
Goal:
they need to be able to open the file by double-clicking it.
i don't want to have to rebuild the excel file using some 3rd party library.
Ideas:
perhaps convert XML to xls using tools like the following:
http://npoi.codeplex.com/
http://excelpackage.codeplex.com/
I'd need some sample code of the simplest and LITEst way of achieving this.
any other ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只是一个随机的想法:如果您要生成 XML 供人们使用 Excel 打开,为什么不首先生成 XSL(或可能是 XSLX)呢?
Just a random thought: if you're generating XML for people to open with Excel, why not generate XSL (or maby XSLX) in the first place?