Hi,
I am using Aspose.Words assembly in .NET to manage Word documents. Can I open an existing word document? I see a Save() method on Document class that saves the document, but I do not see any method to Open the document. Can I open a document that is stored in MemoryStream object without first saving it to disk?
Thanks,
Mahendra
Thank you for your question.
Using Aspose.Words you can open an existing document by simple way:
from a memory stream:
// Open the stream. Read only access is enough for Aspose.Words to load a document.
Stream stream = File.OpenRead(MyDir + "Document.doc");
// Load the entire document into memory.
Document doc = new Document(stream);
// You can close the stream now, it is no longer needed because the document is in memory.
stream.Close();
or direct from existing file:
Document doc = new Document(MyDir + "Document.doc");
Thanks for your reply. What I meant was, can I open an existing word doc file that is saved on the disk in MS word software that is installed on the machine and display it to the user?
Hi There,
Thanks for your inquiry.
Sure, you can use the Process.Start method as shown below. This will open the document in the default viewer, which should be MS Word.
// Open file in MS Word
System.Diagnostics.Process.Start(fileName);
Thanks,
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
Enables storage, such as cookies, related to analytics.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.