Excel 自动化:以“新”方式打开现有 Excel 文件

发布于 2024-07-27 13:08:41 字数 264 浏览 1 评论 0原文

我想为我的应用程序提供“一键式”Excel 导出功能。 因此,我需要在临时位置创建一个 excel 文件,因为我需要使用第三方组件来执行此操作。

我希望 Excel 打开该文件。 我能做到这一点; 但是 Excel 始终会记住加载文件的位置。 我希望加载的文件显示为“新”文件,该文件不会保存到特定位置,因此当用户想要点击“保存”(而不是另存为)或关闭 Excel 时,它会提醒他们未保存的更改。

我在 .net 3.5 上使用 C# 的 Excel 自动化

I want to have a "one-click" excel export feature for my application. I therefore need to create an excel file in a temporary location, because I need to use a third-party component to do so.

I want Excel to then open up the file. I can get to that point; however Excel always remembers the location it loaded the file from. I'd like the loaded file to appear as a "new" file which is not saved to a specific location, so when the user wants to hit "save" (not save as) or close Excel it reminds them of unsaved changes.

I'm using Excel Automation from C# on .net 3.5

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

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

发布评论

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

评论(2

烟火散人牵绊 2024-08-03 13:08:41

您可以指定任何现有的 Excel 工作簿作为模板。 然后使用 Workbooks.Add 方法打开一个新工作簿,Template 参数指向临时模板。

You can specify any existing Excel workbook as the template. Then you use the Workbooks.Add method to open a new workbook, with the Template parameter pointing to the temporary template.

你的呼吸 2024-08-03 13:08:41

嗯...尝试创建和 Excel 模板,然后打开模板?

Hmm... try creating and excel template instead and then open the template instead?

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