使用Asp.net在浏览器中查看和编辑.doc,.xls,ppt文件 [英] View and Edit .doc ,.xls ,ppt files in the Browser Using Asp.net

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

问题描述

我需要以下要求。



用户应该能够在浏览器中查看和编辑doc,xls,ppt等文件。

这些文件不应该打开应用程序,意思是说我不应该打开对话框



我已经付出了努力并找到了解决方案当用户点击某个链接时,在浏览器中显示pdf,jpg格式的文件。



我也可以在浏览器中显示仅包含文本的MSword文件并且没有格式化,无法在浏览器中显示Msdocument的图像,表格。





我在下面付出了努力。



如果有人可以提供帮助,我将非常感谢他们





在此先感谢



I need the following requirement.

The user should be able to view and edit the doc,xls,ppt etc file in the browser .
These files should not open with application,mean to say that i should not get "open with dialog box

I have put my efforts and find the solution to display pdf,jpg formatted files in the browser when the user clicks on some link.

I am also able to display the MSword file in the browser which contains text only and also without formatting ,unable to display the images,tables of Msdocument in the browsers.


I am giving my efforts below.

If anyone could help i will be very thankful to them


Thanks in Advance

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Office.Interop.Word;
using Microsoft.Office.Interop;
using Microsoft.Office;
public partial class MSWord_Display : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.Params.Count > 0)
        {
            if (Convert.ToString(Request["word"]).Length > 0)
            {
                string name = @"D:\prasad\working Folder\sandhya_1.doc";
                //ApplicationClass
                ApplicationClass oWordApp = new ApplicationClass();
                object fileName = name;
                object readOnly = true; //open with dialog will not be opened if it is true
                object isVisible = true;
                object missing = System.Reflection.Missing.Value;
                Document oWordDoc = oWordApp.Documents.Open(
                                            ref fileName,
                                            ref missing, ref  readOnly,
                                            ref missing, ref missing, ref missing,
                                            ref missing, ref missing, ref missing,
                                            ref missing, ref missing, ref isVisible,
                                            ref missing, ref missing, ref missing, ref missing);
                oWordDoc.Activate();
                txtArea.InnerHtml = oWordDoc.Content.Text;
            }
            else
            {
                divMsword.InnerHtml = "<b> Document name is missing: </b>";
            }
        }
    }
    }

推荐答案

你将无法在浏览器中为MSWord文件构建一个编辑器。如果您进行了研究,您会发现此版本中Word文档的格式非常复杂,很难在HTML页面中表示。因为他们使用Open XML标准,你有机会使用MS Word以后的版本。
You will not be able to build an editor for MSWord files in the browser. If you did your research you would see the format of a Word document in this version is very complex and very difficult to represent in an HTML page. You stand a chance with later versions off MS Word since they use the Open XML standard.


如何使用asp.net在线浏览器中的任何类型的文件
how can i any type of file in browser online using asp.net


这篇关于使用Asp.net在浏览器中查看和编辑.doc,.xls,ppt文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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