本文介绍了使用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>";
            }
        }
    }
    }

推荐答案



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

1403页,肝出来的..

09-06 08:02