打开 Word 文档

发布于 2024-08-22 20:31:34 字数 41 浏览 1 评论 0原文

如何在 VB.NET 中打开 Word 文档。该文档是该程序的手册。

How do you open a word document in VB.NET. The document is a manual for the program.

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

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

发布评论

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

评论(4

_蜘蛛 2024-08-29 20:31:34

您需要调用Process.Start(documentPath)

You need to call Process.Start(documentPath).

孤单情人 2024-08-29 20:31:34

您可以通过以下方式打开它:

Dim oWord As Word.Application
Dim oDoc As Word.Document
oWord = CreateObject("Word.Application")
oWord.Visible = True
oDoc = oWord.Documents.Add("C:\wordfile.docx")

不要忘记使用 Imports Microsoft.Office.Interop.Word

You open it by:

Dim oWord As Word.Application
Dim oDoc As Word.Document
oWord = CreateObject("Word.Application")
oWord.Visible = True
oDoc = oWord.Documents.Add("C:\wordfile.docx")

Don't forget to use Imports Microsoft.Office.Interop.Word

朮生 2024-08-29 20:31:34

使用 Process.Start 在适当的编辑器中启动 Word 文档。

如果您有权访问程序集,则可以使用 Microsoft.Office.Interop.Word 命名空间在代码中操作 Word 文档,尽管这可能远不如 Excel 互操作那么简单,除非您制作非常简单的word文档。

Use Process.Start to launch a Word document in the appropriate editor.

If you have access to the assemblies, you can use the Microsoft.Office.Interop.Word namespace to manipulate Word documents in code, though this is probably nowhere near as trivial as Excel interop, unless you're making very simple word documents.

如果没有 2024-08-29 20:31:34

Microsoft Web 浏览器控件可以显示 ActiveX 文档。该控件可以放置到 WinForms 或 WPF 应用程序中

Microsoft Word 是一个 ActiveX 文档提供程序。因此,您可以将 Microsoft Word 文档加载到 Web 浏览器控件中。 查看 VB.Net 2005 的示例

然后您就可以完全控制Microsoft Word 子窗口的。加载任何文档,调整窗口大小,更改可见性等,您甚至可以发送控制消息(宏)

其他一些SO参考:

The Microsoft Web Browser Control can display ActiveX documents. This control can be placed onto a WinForms or WPF application

Microsoft Word is a ActiveX document provider. So you can load Microsoft Word documents into the Web Browser control. See this example for VB.Net 2005

You then have total control of the Microsoft Word child window. Load any document, re-size window, change visibility etc, you can even send control messages (macros)

Some other SO references:

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