Click here to Skip to main content
15,890,995 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
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
C#
strWordTemplatePath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);

to get path of the file located in local machinen and used
C#
string strWordDocumentFulPath = Path.GetFullPath(strWordTemplatePath + "TestFile.docx");
System.Diagnostics.Process.Start(strWordTemplateDot);



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
Posted
Updated 29-Jul-14 10:49am
v4
Comments
Sergey Alexandrovich Kryukov 19-Mar-14 16:29pm    
Why? Word is not a part of W3 standards. You can only submit (upload) the document and process it on the server side. For presenting it, you should map it to some other data format...
—SA
Member 10262527 19-Mar-14 16:52pm    
According to our application we need to support the word documents.
Sergey Alexandrovich Kryukov 19-Mar-14 17:36pm    
How? What exactly it should be? As I say, you cannot directly show them on a page. So, do you need to present them? How about mapping to HTML and showing a document as an HTML page? Anything else?
—SA

Directly speaking, you can NOT open document in Silverlight using Process.Start method.

Here is an idea: Opening a Microsoft Office documents with Silverlight [^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 19-Mar-14 17:37pm    
Interesting, a 5.
—SA
Maciej Los 19-Mar-14 17:50pm    
Thank you, Sergey ;)
Member 10262527 20-Mar-14 13:25pm    
So, is there any way to open a document in silverlight, (like process.start)
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
 
Share this answer
 
Comments
Member 10262527 20-Mar-14 14:49pm    
Thank u for ur comment Rana, So here my requirement is These templates should be in clients machine. our people dont want them to be placed in server and then allow user to download the templates from server to local machine.

So, My idea is.. when user navigate to this certain page, runs an windows application that shows the grid with all documents available and the user can interact with the client machine to open them on click.

But was it doable, if so can anyone suggest me any articles which can help me to accomplish this requirement.
Hassue Rana 20-Mar-14 15:01pm    
Dear round about 5 years ago i had faced the same situation. one of my client was asking the same thing. that time i worked a lot to find out some good solution but was unable. even i tried with java script but was useless.
Member 10262527 20-Mar-14 16:22pm    
yeah, seems like all my optional are closing with this requirement. Not able to find a good reliable solution or the way to handle this requirement. Thank You Rana

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900