在Asp.net中打开Word女士 [英] Open Ms Word in Asp.net

查看:81
本文介绍了在Asp.net中打开Word女士的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在尝试打开现有的Word文档,执行时会发生
没有错误,但没有出现Word并且我的文档没有打开.

这是我正在使用的代码.

Hi,

I am trying to open an existing word document, the execution happens
with no error but Word does not come up and my document does not open.

This is the code I am using..

Process.Start(@"C:\Program Files\Microsoft Office\OFFICE11\winword.exe");
        ProcessStartInfo info = new ProcessStartInfo(@"C:\Program Files\Microsoft Office\OFFICE11\winword.exe");   




我使用了另一种方法来执行此操作,但结果是相同的...使用的另一种方法是




I used another way to do this, but the result is same...the other way is used is

protected void Button1_Click(object sender, EventArgs e)
    {
        CCWordApp test;
        test = new CCWordApp();
        test.Open(@"D:\Experiments\WordOpen\Letter\Brief India foutieve facturen.doc");

    }





public class CCWordApp
{
    private Word.ApplicationClass oWordApplic =new Word.ApplicationClass();	// a reference to Word application
	private Word.Document oDoc=new Word.Document();		
	public CCWordApp()
	{
		//
		// TODO: Add constructor logic here
		//
	}
            // Open a file (the file must exists) and activate it
        public void Open(string strFileName)
        {
            object fileName = strFileName;
            object readOnly = false;
            object isVisible = true;
            object missing = System.Reflection.Missing.Value;
            oWordApplic.Visible = true;
            oDoc = oWordApplic.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);
            oDoc.Activate();
         }

           
         }









请帮助我









Please Help me

推荐答案

确实如此.

但是它在SERVER而不是CLIENT上打开.您无法在客户端计算机上打开任何应用程序-被称为可能是病毒活动",并且出于安全原因被严格禁止.
It does, you know.

But it opens on the SERVER, not the CLIENT. You cannot open any application on the client computer - that is known as "probably virus activity" and is heavily forbidden upon for security reasons.


MS Word是一个应用程序,没有任何意义.在ASP.net Web应用程序中使用它的原因有很多,其中有几个原因:

-您需要在网络服务器上安装Office.
-您的用户将看不到Word UI.
-无法扩展到超过5个实例.

通常,这是一个坏主意,最好使用服务器端组件来生成或处理DOC文件.
MS Word is an application and it does not make sense to use it in a ASP.net web application for many reasons a few of which are :

- You will need to install office on your web server.
- Your users will not see Word UI.
- It is not scalable beyond 5 instances.

Generally this is a bad idea, you are better off using server side components for generating or processing DOC files.


这篇关于在Asp.net中打开Word女士的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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