Newbie question.
I am using Aspose.Words in a web application to create a document and store it on a file server (not the web server).
Using the web application I now want to open that document for the user using Word. i.e. User is on their PC with a copy of MS Word, the file is on a shared drive. (Of course, the letter used to denote the shared drive is different for different users.)
How can I achieve this simple task?
Many thanks
Richard
Hi Richard,
Thanks for your request. Since you would like to open the document from Web application, the only way to achieve this is sending the document to client browser. You can achieve this using Save method:
https://reference.aspose.com/words/net/aspose.words/document/save/
Or if the document already exists, you can use code like the following:
byte[] bytes = GetYourDocumentBytes();
Response.Clear();
// Specify the document type.
Response.ContentType = "application/msword";
// Other options:
// Response.ContentType = "application/msword"
// Response.ContentType = "text/plain"
// Response.ContentType = "text/html"
// Specify how the document is sent to the browser.
Response.AddHeader("content-disposition", "attachment; filename=test.doc");
// Another option could be:
// Response.AddHeader "content-disposition","inline; filename=MyDocument.doc";
// Get data bytes from the stream and send it to the response.
Response.BinaryWrite(bytes);
Response.End();
Hope this helps.
Best regards,
Alexey
I am already doing something similar to your suggestion, but it is not what I need.
The document MUST live on the file server. I want the user to edit the newly created document in MSWord, but when they press save, the document is saved back to the file server.
I would have thought that there would be some way of firing up MS Word through a shell or something like that and passing it a parameter which is the path to the document.
Somebody out there must be doing this already.
Regards
Richard
Hi Richard,
Thank you for additional information. But, as you may know, you cannot run any application on client side from Web application. So you cannot just open document on client side from Web application.
If your document is located on shared drive and end user have permissions to open/save documents on this drive, you should just provide a path to the document and and user will be able to open document from this drive.
Best regards,