如何使用c#在windows窗体中打开word文档? [英] how to open word document inside windows form using c#?

查看:727
本文介绍了如何使用c#在windows窗体中打开word文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想打开word文档,它会在我的机器上运行但是在发布word文件后单独打开。

I want to open word document inside form it will work on my machine but after publish word file open separately.

推荐答案

我猜你是使用InterOp库,它要求各种Office应用程序驻留在执行应用程序代码的系统上。 Microsoft已明确表示此库仅应用于本地计算机开发(即Windows应用程序),不应用于Web应用程序。



对于Web应用程序,您可以使用DocumentFormat.OpenXML库复制此行为。您需要在此处下载该扩展程序: https://www.nuget.org/packages/DocumentFormat.OpenXml/ [ ^ ]



网上有一些教程可供使用。
I'm guessing that you're using the InterOp library, which requires that the various Office applications are resident on the system that is executing the application code. Microsoft has made clear that this library should only be used for local machine development (ie Windows applications) and should not be used for Web applications.

For Web Applications you can replicate this behaviour using the DocumentFormat.OpenXML library. You will need to download the extension for it here: https://www.nuget.org/packages/DocumentFormat.OpenXml/[^]

There are some tutorials for use around the web.


这篇关于如何使用c#在windows窗体中打开word文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆