Hi,
I created an Aspose doc by reading a word doc wich contains an image, and saved to memorystream as rtf and genrated string. Then I used this string as the RTF of a RichTextBox, but image does not appear. But when I save this to a rtf file instead of saving to a stream as rtf, image appears. Please verify the case and tell me whats the problem with the rtf string genrated by Aspose.
Please go through the following cases to get a clear idea.
case 1.
// create an aspose doc using a word doc contains an image
Document doc = new Document(@"C:\test\1.doc");
MemoryStream saveStream = new MemoryStream();
doc.Save(saveStream, SaveFormat.Rtf);
byte[] rtfBytes = saveStream.GetBuffer();
// Get string from byte array
string rtfString = System.Text.Encoding.UTF8.GetString(rtfBytes, 0, (int)saveStream.Length);
saveStream.Dispose();
rtfBytes = null;
richTextBox1.Rtf = rtfString;
// result : image is not shown
case 2:
// create an aspose doc using a word doc contains an image
Document doc = new Document(@"C:\test\1.doc");
doc.Save(@"C:\Documents and Settings\abdul.ali\Desktop\asposeRTFFromAsposeDoc.rtf", SaveFormat.Rtf);
// result : image appears
case 3:
// create a word doc with the same image in it, save as rtf file, get the rtf string [open with notepad] and save as a txt file. read the content and set as rtf to a richtextbox
System.IO.TextReader tr = new System.IO.StreamReader(@"C:\test\1.txt");
string str = tr.ReadToEnd();
richTextBox1.Rtf = str;
tr.Dispose();
// result : image appears in Richtextbox.
Please verify and give me the reason if there is anything wrong in the rtf generated by Aspose, or it could be a mistake of mine.
Thank you,
Ali