C# 取消 Word 列表库显示
以下是使用 C# 取消 ListGalleries 的示例代码:
using Microsoft.Office.Interop.Word;
// 创建 Word 文档对象
Application wordApp = new Application();
Document doc = wordApp.Documents.Add();
// 获取 ListGalleries 对象并取消其显示
ListGalleries listGalleries = wordApp.ListGalleries[WdListGalleryType.wdNumberGallery];
listGalleries.ResetOnTop = false;
// 保存并关闭文档
doc.SaveAs('example.docx');
doc.Close();
wordApp.Quit();
上述代码中,我们使用 Microsoft.Office.Interop.Word 命名空间中的 Application 和 Document 类来创建和操作 Word 文档。首先,我们获取 ListGalleries 对象并将其 ResetOnTop 属性设置为 false,以取消其显示。最后,我们保存并关闭文档,退出 Word 应用程序。
原文地址: https://www.cveoy.top/t/topic/oX6Y 著作权归作者所有。请勿转载和采集!