在运行时在word中添加书签

发布于 2024-09-28 13:28:30 字数 200 浏览 1 评论 0原文

我必须使用 Microsoft.Office.Tools.Word.ControlCollection

AddBookmark 方法在 ControlCollection 类中可用,在 Word 文档中添加书签,但是当我尝试创建以下对象时 ControlCollection,它抛出错误,因为此类没有定义构造函数...

如何在Word文档中添加书签?

I Have to add a bookmark in Word doc using Microsoft.Office.Tools.Word.ControlCollection

AddBookmark method is available in ControlCollection class, however when I try to create the object of
ControlCollection, it throws and error because this class has no constructor defined...

How can I add a bookmark in word document?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

So要识趣 2024-10-05 13:28:30

AddBookmark 方法可用于 Microsoft.Office.Tools.Word.Document 类的实例。

我不知道如何在 Microsoft.Office.Tools.Word.Document 类中加载文档。

但是,有一种方法“DocumentExtensions.GetVstoObject”可以从 Microsoft.Office.Interop.Word.Document 对象返回 Microsoft.Office.Tools.Word.Document 对象。 Microsoft.Office.Tools.Word.v4.0.Utilities 程序集中定义的 DocumentExtensions 类。但我在“添加引用”对话框中找不到该程序集...看起来该程序集仅在 .net 4.0 中可用..

---Sambhaji

The AddBookmark method is available on instance of Microsoft.Office.Tools.Word.Document class.

I dont know how to load document in Microsoft.Office.Tools.Word.Document class.

However,There is one method "DocumentExtensions.GetVstoObject" available that returns a Microsoft.Office.Tools.Word.Document object from Microsoft.Office.Interop.Word.Document object. The DocumentExtensions class defined in Microsoft.Office.Tools.Word.v4.0.Utilities assembly. But I do not find this assembly in Add reference dialog... It looks like this assembly available only in .net 4.0..

---Sambhaji

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文