如何使用asp.net在浏览器中打开/编辑MS Excel / doc文件 [英] How to open/edit MS Excel/doc file in browser using asp.net

查看:97
本文介绍了如何使用asp.net在浏览器中打开/编辑MS Excel / doc文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个Web应用程序,用户可以直接在Web浏览器中查看和编辑MS Excel / Doc文件,而无需在其计算机上安装MS Office。 MS office将仅安装在将托管此应用程序的服务器上。请使用C#和asp.net建议适当的解决方案。

解决方案

浏览器不应支持此专有格式。即使您希望您的解决方案基于MS Office格式(我不推荐,但很多网站都是这样),您需要在某些类文档和HTML之间定义一些映射,将文档表示为HTML,并通过可编辑的HTML提供编辑功能。当用户更新文档时,您可以使用您定义的映射将其转换回Office格式。



可编辑的HTML可以基于此功能:

 <   div     contenteditable   =  true >  
< p > 一些初始内容,可选... < / p >
< < span class =code-leadattribute> / div >





如果您在HTML页面上添加此片段,则用户将能够进行编辑它;你需要为这种编辑器添加格式化控件。

请参阅:

http ://www.w3.org/TR/2008/WD-html5-20080610/editing.html [ ^ ](见5.2),

https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_Editable [ ^ ]。



您可以使用许多专用的基于Javascript的HTML编辑器。请参阅:

http://en.wikipedia.org/wiki/HTML_editor#WYSIWYG_HTML_editors [ ^ ],

http://en.wikipedia.org/wiki/HTML_editor#Online_editors [ ^ ]。



< DD> -SA


I have a requirement to create a web application where user will be able to view and edit MS Excel/Doc files directly in web browser without having installed MS office on his machine. MS office would be installed on only server where this application will be hosted. Please suggest the appropriate solution using C# and asp.net.

解决方案

Browsers are not supposed to support this proprietary format. Even if you want your solution to be based on the MS Office format (which I would not recommend, but many sites to exactly that), you would need to define some mapping between some class of documents and HTML, represent the document as HTML, and provide the editing capabilities through editable HTML. When the document is updated by the user, you can convert it back to Office format using the mapping your defined.

Editable HTML can be based on this feature:

<div contenteditable="true">
   <p>Some initial content, optional...</p>
</div>



If you add this fragment on your HTML page, the user will be able to edit it; and you will need to add formatting controls to such "editor".
Please see:
http://www.w3.org/TR/2008/WD-html5-20080610/editing.html[^] (see 5.2),
https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_Editable[^].

There are many dedicated Javascript-based HTML editors you can use. Please see:
http://en.wikipedia.org/wiki/HTML_editor#WYSIWYG_HTML_editors[^],
http://en.wikipedia.org/wiki/HTML_editor#Online_editors[^].

—SA


这篇关于如何使用asp.net在浏览器中打开/编辑MS Excel / doc文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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