将 Word Excel 加载到 WPF 中
我想将 Word 或 Excel 文档加载到 WPF 应用程序的窗口中,以便用户可以在应用程序中查看或编辑该文档。有什么办法可以实现这一点吗?
I would like to load a Word or Excel document into a window of a WPF application so that users can view or edit the document within the application. Is there any way to achieve that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
为了简化操作,您可以将文档打印到 Office 或 Windows(不记得是哪一个)附带的 XPS,作为名称为“Microsoft XPS Document Writer”的打印机。
获得文档后,可以使用以下视图显示该文档:
并且只需设置文档即可。
为此,您只需引用“ReachFramework”即可。
至于编辑支持,您可以使用 XPS 规范提供的 XPS 操作策略。
To simplify things what you can do is print the document to XPS which comes with office or Windows (can't remember which) as a printer of the name "Microsoft XPS Document Writer".
Once you have the document, this can be displayed using a view of:
And simply set the document.
For this to work you only need to reference "ReachFramework".
As for edit support you can use the XPS manipulation strategies provided by the XPS specification.
您可以从工具箱添加 Web 浏览器控件,然后在其中加载 Word 文档。
您甚至可以打开浏览器支持的任何文档,例如 Word、Excel、PDF、SWF 等...
示例加载 Word
示例加载 Excel
You add web browser control from toolbox and then load the Word document in it.
You can even open any document that browser support e.g. Word, Excel, PDF, SWF etc...
Example Load Word
Example Load Excel
SpreadsheetGear for .NET 附带 .NET Windows 窗体控件,可以在 WPF 应用程序中轻松使用它来查看和编辑 Excel 文档。
如果您想亲自尝试,可以在此处下载免费试用版。
免责声明:我拥有 SpreadsheetGear LLC
SpreadsheetGear for .NET comes with a .NET Windows Forms control which can easily be used in WPF applications to view and edit Excel documents.
You can download a free trial here if you want to try it yourself.
Disclaimer: I own SpreadsheetGear LLC