从Web应用程序打开本地Word文档
您好,在我们的应用程序中,我们需要打开位于本地计算机中的一些word文档。
我有一个带有列表文件名的网格,当用户点击行时,我想打开位于本地c:\驱动器中的文档。
我试图使用
Hello, In our application we need to open some word documents located in local machines.
I have a grid with the list file names, when user clicks on row, i want to open the document located in local c:\ drive.
I tried to use
strWordTemplatePath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
获取位于本地机器中的文件的路径并使用
to get path of the file located in local machinen and used
string strWordDocumentFulPath = Path.GetFullPath(strWordTemplatePath + "TestFile.docx");
System.Diagnostics.Process.Start(strWordTemplateDot);
当工作正常我在本地运行,但是当发布到服务器时,路径被定向到服务器文件夹。
有没有更好的方法从Web应用程序打开word文档,看到这么多关于如何访问本地文件的参考..使用silverlight和一些java ..我不知道如何在silverlight或java中实现。
发现一篇文章提到了关于如何访问本地文件的web应用程序中使用silverlight的outofbrowser应用程序。
http://weblogs.asp.net/nmarun/archive/2009/11/27/local-file-access-silverlight -4.aspx?
不确定如何打开word文档..
有人可以指引我进入正确的道路......
谢谢
its works fine when i run locally, but when published to server the path is directed to server folders.
is there any better way to open a word document from web application, Seen so many references about how to access the local files.. using silverlight and some java.. Am Not sure how to implement in silverlight or java.
Found one article mentioning about outofbrowser application useing silverlight in web aplication on how to access the local file.
http://weblogs.asp.net/nmarun/archive/2009/11/27/local-file-access-silverlight-4.aspx?
Not sure how to open a word document..
Can Someone direct me into correct path...
Thank you
直接来说,你无法使用Process.Start
方法在Silverlight中打开文档。
这里是一个想法:使用Silverlight打开Microsoft Office文档 [ ^ ]
Directly speaking, you can NOT open document in Silverlight usingProcess.Start
method.
Here is an idea: Opening a Microsoft Office documents with Silverlight [^]
当你在本地机器上运行代码时,你的系统像服务器一样运行,你在服务器上运行....
当你在某个服务器上托管它并尝试o在这种情况下,笔记本放在您的系统上您的机器是客户端机器。你现在不能说它本地...
你可以打开服务器上的任何东西,即使你可以执行exe文件,但只能在你托管的服务器上你的应用程序。
使用asp.net你无法打开放在客户端机器上的任何东西。因为asp.net是服务器端。
用于从客户端机器读取任何文件,需要客户端脚本,如Java Script等
when you run the code on your local machine at that time your system works like server and you do it on server....
when you host it on some server and try to open document placed on your system in this case your machine is client machine. you can't say it local now...
well you can open any thing on the server even you can execute exe files but only on server where you have hosted your application.
using asp.net you cannot open anything that is placed on client machine. because asp.net is server side.
for reading any file from client machine you need client side scripting like Java Script etc