将 VSTO Word 2007 模板应用程序保存到 docx,而不提示保存模板
重现步骤:
- 创建 Word 2007 模板项目 (Visual Studio 2008 Professional SP1)
- 将 DateContentControl 放在文档上
- 保存、发布、打开 .dotx
- 修改 DateContentControl、保存
- 单击否、关闭 Word
- 打开保存的文档、修改 DateContentControl - 后续保存时不再有提示。 ..
- 更改项目代码、发布、更新 VSTO 应用程序、打开 .dotx、重复步骤 4
Word 2007 模板应用程序如何允许用户修改文档而不提示保存?
Steps to reproduce:
- Create Word 2007 Template Project (Visual Studio 2008 Professional SP1)
- Place DateContentControl on document
- Save, Publish, open .dotx
- Modify DateContentControl, Save
- Click No, Close Word
- Open Saved document, Modify DateContentControl - no more prompts on subsequent saves...
- Change project code, publish, update VSTO app, open .dotx, repeat step 4
How does a Word 2007 Template application allow a user to modify the document without getting prompted on a save?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Word会检查文档附加模板是否被修改,并提示是否保存更改。 为了避免出现此类提示,您可以将附加模板的
Saved
属性设置为true
。在 VBA 中,这将是:
Word checks whether the attached template of a document has been modified and prompts whether to save the changes. To avoid such a prompt you could set the
Saved
property of the attached templated totrue
.In VBA this would be:
谢谢迪沃。
以下是 VSTO 的 C# 中的 2 行:
Thanks divo.
Here are the 2 lines in C# for VSTO: