Word interop在选择中插入/添加自定义文档属性

时间:2014-09-11 13:36:26

标签: c# ms-word interop

我试图通过Word interop为c#插入customDocumentProperty但我找不到任何操作方法。我可以访问应用程序和activeDocument属性,但我不知道在哪里插入属性。

添加新属性并且更改值也可以。

1 个答案:

答案 0 :(得分:0)

我自己修好了,

您需要将其添加到以下字段中:

    Globals.ThisAddIn.Application.Selection.Fields.Add(Globals.ThisAddIn.Application.Selection.Range, Word.WdFieldType.wdFieldDocProperty, prop.Name, true);

这可能不是最好的方法,但它有效:)

相关问题