Free Support Forum - aspose.com

Aspose Words Document to MemoryStream to RichText Box Scrambles Text

I need to display a word document in a rich text box however when i run the below code with the attached CV it works but appears all scrambled.

Dim l As New Aspose.Words.License
l.SetLicense(“Aspose.Words.lic”)

Dim doc As New Aspose.Words.Document(dlgOpen.FileName)
Dim fs As New IO.MemoryStream
doc.Save(fs, Aspose.Words.SaveFormat.Rtf)
fs.Seek(0, IO.SeekOrigin.Begin)
RichTextBox1.LoadFile(fs, RichTextBoxStreamType.RichText)
fs.Close()

Thank you

Hi

Thank you for your interest in Aspose.Words. It seems that this is problem of RichTextBox control. I tried to convert this document to RTF using MSWord and load to RichTextBox and I have got almost the same result. I used the following code.

Dim fs As IO.Stream = New IO.FileStream("in.rtf", IO.FileMode.Open)

RichTextBox1.LoadFile(fs, RichTextBoxStreamType.RichText)

fs.Close()

Best regards.