Word VSTO - 向 Word 文件添加标签
Word VSTO - Adding a tag to a Word file
我想以用户可以看到但不影响文档内容的方式标记由我的加载项处理的文档。在 Word 中,如果转到“文件”菜单,您会发现可以将 tags 添加到 Word 文件中。如果启用 "Tags" 列,这些标签可以显示在 Windows 资源管理器中。也可以从资源管理器中设置标签。
我无法找到如何以编程方式访问这些标签。谁能给我提示?
您正在寻找 Document.BuiltInDocumentProperties
.
例如:
var properties = (Microsoft.Office.Core.DocumentProperties)
Globals.ThisAddIn.Application.ActiveDocument.BuiltInDocumentProperties;
properties["Keywords"].Value = "Processed by my add-in";
我想以用户可以看到但不影响文档内容的方式标记由我的加载项处理的文档。在 Word 中,如果转到“文件”菜单,您会发现可以将 tags 添加到 Word 文件中。如果启用 "Tags" 列,这些标签可以显示在 Windows 资源管理器中。也可以从资源管理器中设置标签。
我无法找到如何以编程方式访问这些标签。谁能给我提示?
您正在寻找 Document.BuiltInDocumentProperties
.
例如:
var properties = (Microsoft.Office.Core.DocumentProperties)
Globals.ThisAddIn.Application.ActiveDocument.BuiltInDocumentProperties;
properties["Keywords"].Value = "Processed by my add-in";