使用 Excel 工作表作为模板与“真实”工作表的比较OpenXML 中的 Excel 模板

发布于 2024-08-30 13:50:06 字数 291 浏览 3 评论 0原文

有什么区别

  • 有没有人有任何好的答案,使用任意预先格式化的 Excel 2007 *.xlsx 文件作为模板,将其加载到我的 C# 应用程序中,并使用 Microsoft OpenXML SDK 用数据填充其某些单元格之间

  • 创建特定的 Excel 模板 (*.xltx) 文件并将其用作“数据填充”练习的基础

当我不使用 Excel 模板 (*.xltx) 时,我是否会丢失某些内容?

如果是这样 - 我会失去什么?

Does anyone have any good answer what kind of difference there is between

  • using some arbitrary pre-formatted Excel 2007 *.xlsx file as a template, loading it in my C# app, and filling up some of its cells with data using the Microsoft OpenXML SDK

versus

  • creating specific Excel templates (*.xltx) files and using those as basis for my "data filling" exercise

Do I loose something when I don't use the Excel templates (*.xltx)?

If so - what do I loose?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

鹿港巷口少年归 2024-09-06 13:50:06

不,你根本不会失去任何东西。 XLTX 在所有方面与 XLSX 相同 - 只是如果打开的文件是 XLTX,Excel 会创建 XLSX 的新实例。就这样。如果您使用 XLTX 进行数据填充并保存 XLSX,则打开生成的 XLSX 时,每个新实例 (XLSX) 都将具有该数据。

另一个问题是,如果您从 OOXML 进行数据填充,是否需要使用 XLTX - 我看不出有任何理由需要使用 XLTX,只要您预先格式化XLSX 以不同的文件名保存,您的 XLSX 作为模板应该没问题。 XLTX 实际上适用于 Excel 客户端应用程序操作 - 诸如 OOXML 之类的编程解决方案在使用不同的文件扩展名方面没有任何优势(但 VSTO 则不然,它也是 Excel 客户端应用程序操作)。

No, you don't lose anything at all. An XLTX is the same as an XLSX in all respects - it's just that Excel creates a new instance of an XLSX if the file opened is an XLTX. That's all. If you use an XLTX for your data filling and save out an XLSX, every new instance (XLSX) will have that data when the resulting XLSX is opened.

The other question is whether or not you need to use an XLTX at all if you are doing your data-filling from OOXML - I don't see any reason why you would need to use an XLTX at all as long as your pre-formatted XLSX is saved with a different file name, your XLSX should be fine as a template. An XLTX is really meant for Excel client app operation - programmatic solutions such as OOXML offer no benefits in using a different file extension (not true of VSTO however, which is also an Excel client app operation).

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