如何在MVC 4中的视图上显示和编辑word文档 [英] How to display and edit word document on the view in MVC 4

查看:145
本文介绍了如何在MVC 4中的视图上显示和编辑word文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨专家,



根据客户要求我想显示,编辑视图上的word文档,我想将修改过的word文档保存到数据库中。



1)在使用OPENXML DLL将word文档转换为HTML字符串后,我将word文档显示到HTML TextArea控件,我能够显示word文档文本HTML Textarea控件,但我失去了文本的格式和对齐方式。



我希望word文档内容对齐和格式化应该与word文档中的相同在TextArea控件中渲染。



我无法实现word文档内容的格式化和对齐。





我怎样才能使用OPENXML(不使用Microsoft Word互操作)。或者是否有任何其他方法使用哪个至少我们可以在视图上显示它。





2)我想在显示后编辑word文档。我怎么能这样做





请帮忙解决这些问题。我会感激你的。在此先感谢。

Hi Experts,

As per client requirement I want to display , edit the word document on the view and I want to save modified word document into the Database.

1) I m displaying word document to HTML TextArea control after converting word document to HTML string using OPENXML DLL , I m able to display word document text as it is in the HTML Textarea control but I m losing formatting and alignments of text.

I want word document content alignment and formatting should same as it is in the word document when it will render in the TextArea control.

I m not able achieving formatting and alignment of word document content .


How Can I do it using OPENXML only (without using Microsoft Word interop.) OR Is there any other approach using which atleast we can display it on the view.


2) I want to edit word document after displaying . How can I do it


Please help out with these issues. I will appreciate you. Thanks in advance.

推荐答案

使用OpenXML转换为HTML无法做到这一点。你要保留格式和其他一切的唯一方法是,如果客户端安装了Word(显然,文档的适当版本!)并将文档发送给客户端一个完整的Word文件,让用户编辑它在Word中然后Word必须将其发送回保存它。



不,我没有任何示例代码。
You can't do that using a conversion to HTML using OpenXML. The only way you're going to keep the formatting and everything else is if the client has Word installed (obviously, an appropriate version for the document!) and sent the document to the client an an intact Word file, let the user edit it in Word and then Word has to send it back to "save" it.

No, I don't have any example code.


这篇关于如何在MVC 4中的视图上显示和编辑word文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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