【问题标题】:VBA "style().LinkToListTemplate ListTemplate := Nothing" in c# word interopC# word interop 中的 VBA“style().LinkToListTemplate ListTemplate := Nothing”
【发布时间】:2018-09-07 04:03:35
【问题描述】:

有一个单词VBA方法"style("style").LinkToListTemplate ListTemplate:=Nothing" 用于将样式编号设置为None。 我的问题是我在 C# word interop 中找不到相同的内容。 该方法存在,但不适用于 style.LinkToListTemplate(null)。

【问题讨论】:

    标签: c# vba ms-word interop word-style


    【解决方案1】:

    LinkToListTemplate 方法需要一个 ListTemplate 对象。 VBA 并不那么挑剔,它为开发人员解决了问题。以下对我有用:

    Word.ListTemplate lt = null;
    styl.LinkToListTemplate(lt); 
    

    注意:在测试时,我注意到这样做会在文档中创建额外的 ListTemplates。如果您在一个文档中执行很多操作,这可能会成为问题。在引入 ListTemplates 的版本中(我记得是 97),它可能会损坏文件,甚至使它们崩溃。 MS 通过让 Word 在累积关键数量时自动删除未使用的 LT 来解决此问题。但它会影响文件大小。仅供参考:-)

    【讨论】:

      猜你喜欢
      • 2015-06-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-27
      • 1970-01-01
      相关资源
      最近更新 更多