Free Support Forum - aspose.com

How to use Aspose.Words to open a Word document

Hello.

I am trying to create a Word document using Aspose.Words. After creation of the Word document, does it make sense to open the document for the user to view? Most of the examples show the file being saved to disk.

Thanks

Denise

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. You can use Process.Start to open generated document in MS Word. For instance, see the following code:

//Save document

string fileName = @"Test137\out.doc";

doc.Save(fileName);

//Open document in MS Word

Process.Start(fileName);

If you would like just show document preview, you can save the document to image. See any of Aspose.Words demos and select “Rendering - View Document Pages as Images in the Browser

http://www.aspose.com/demos/.net-components/aspose.words/csharp/general/dinner-invitation.aspx

Also, you can use XPS to achieve the same:

http://www.aspose.com/community/blogs/aspose.words-for-.net-java-reporting-services-and-jasperreports/archive/2009/08/14/render-doc-ooxml-odt-rtf-and-html-documents-in-silverlight-using-components-from-aspose-and-first-floor-software.aspx

Hope this helps.

Best regards.