导出 XML -> Excel

发布于 2024-09-11 02:01:07 字数 752 浏览 3 评论 0原文

我已经生成了一个包含 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

纸伞微斜 2024-09-18 02:01:07

只是一个随机的想法:如果您要生成 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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文