从Asp.net应用程序在客户端打开Word文档 [英] Opening Word Document on Client Side from Asp.net Application

查看:131
本文介绍了从Asp.net应用程序在客户端打开Word文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们需要打开位于使用Microsoft Word中的客户端计算机上的服务器上的Word文档。该解决方案是在服务器部署时,但在本地工作那么只有发生的事情是,WINWORD.EXE开始在服务器上。这可能使用互操作或JavaScript做什么?

这是code到现在为止

  Microsoft.Office.Interop.Word.ApplicationClass wordApp =新Microsoft.Office.Interop.Word.ApplicationClass();目标文件=文件路径文件名+;
lblError.Text = lblError.Text + file.ToString();
反对readOnly的= FALSE;
反对objTrue = TRUE;
反对失踪= System.Reflection.Missing.Value;
反对emptyData =的String.Empty;
wordApp.Visible = TRUE;
Microsoft.Office.Interop.Word.Document ADOC =
wordApp.Documents.Open(REF文件,
         裁判失踪,楼盘只读,已
         裁判失踪,失踪参考,参考失踪,
         裁判失踪,失踪参考,参考失踪,
         裁判失踪,失踪参考,参考objTrue);aDoc.Activate();


解决方案

这是在本地工作的原因,是因为,它不是。什么情况是,服务器打开文档,因为你的本地机器充当看来好像打开文件服务器。

一个简单的解决方案是为用户下载文件,编辑,并上传回给你。

We need to open a word document which is located on a server on the clients machine using Microsoft Word. The solution is working locally however when deployed on server then only thing that happens is that the winword.exe is started on the server. Is this possible to do using interop or javascript?

this is the code till now

Microsoft.Office.Interop.Word.ApplicationClass wordApp = new Microsoft.Office.Interop.Word.ApplicationClass();

object file = FilePath + FileName;
lblError.Text = lblError.Text + file.ToString(); 
object readOnly = false;
object objTrue = true;
object missing = System.Reflection.Missing.Value;
object emptyData = string.Empty;
wordApp.Visible = true;
Microsoft.Office.Interop.Word.Document aDoc                         =
wordApp.Documents.Open(ref file,
         ref missing, ref readOnly,
         ref missing, ref missing, ref missing,
         ref missing, ref missing, ref missing,
         ref missing, ref missing, ref objTrue);

aDoc.Activate();

解决方案

The reason it is working locally, is because, well, it isn't. What's happening is that the server is opening the document, but because your local machine is acting as the server it appears as if the file is opened.

One simple solution is for the user to download the file, edit it and upload it back to you.

这篇关于从Asp.net应用程序在客户端打开Word文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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