【问题标题】:c# OPEN XML word - Table of contents emessage on loadc# OPEN XML word - 加载时的目录消息
【发布时间】:2018-10-14 02:40:55
【问题描述】:

我正在使用 OPEN XML SDK Framework 从 C# 在 MS Word 中创建目录。每次打开文档时创建 docx 后,它都会向我显示消息 This document contains fields that may refer to other files. Do you want to update the fields in this document ?。 我不希望用户每次打开文档时都看到此消息。是否有任何替代方法可以在不通过取消选中单词设置的路径的情况下实现相同而没有警告消息。

【问题讨论】:

  • 这是出于安全措施。避免该消息的唯一方法是使用 Sharepoint 中的 Word Automation Services 打开文档。

标签: c# ms-word openxml tableofcontents


【解决方案1】:

如果您可以修改 normal.dotx 模板,那么是的,这是可能的。 Eric White 有一个video here that describes this in much more detail 和一个完整的代码库来处理目录。观看该视频以获取有关如何操作的完整指南,但关键部分是:

  1. 不要将元素设置为脏,删除下面屏幕抓取中的蓝色位:

  2. 不要从代码中更新 TOC 字段

  3. 在 normal.dotx 模板中添加一个 AutoOpen 宏,然后在其中添加以下代码:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多