Free Support Forum -

Display in WinForm

Hi All, can someone point me in the right direction or provide some code examples, I need to be able to display a document (from memory stream) in a winform. I am having a difficult time trying to figure this out using the current documentation. Basically, I am trying to cut out using OfficeInterop and only use Aspose.

Hi Mike,

Thanks for your inquiry. First of all please note that Aspose.Words for .NET is a class library that enables your applications to perform a great range of document processing tasks. Aspose.Words supports DOC, DOCX, RTF, HTML, OpenDocument, PDF, XPS, EPUB and other formats. With Aspose.Words you can generate, modify, convert, render and print documents without utilizing Microsoft Word®. For more information, please go through the documentation below:

Secondly, Aspose.Words does not offer any user interface control to view/edit MS Word documents in winForms. However, you can easily display document in winForms by converting document to images and view the images in winForms. Please use the following code snippet to convert your document to images.

Document doc = new Document(MyDir + “in.docx”);<o:p></o:p>

ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Png);<o:p></o:p>

options.PageCount = 1;<o:p></o:p>

for (int pageIndex = 0; pageIndex < doc.PageCount; pageIndex++)<o:p></o:p>


string outputFileName = MyDir + string.Format("{0}_{1}.png", “Out”, pageIndex + 1);<o:p></o:p>

options.PageIndex = pageIndex;<o:p></o:p>

doc.Save(outputFileName, options);<o:p></o:p>


Hope this answers your query. Please let us know if you have any more queries.

Thank you, that is very helpful.

Hi Mike,

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.