Is there a way to display an rtf image (INCLUDEPICTURE) reference in a RichTextBox?
Content of rtf file:
{\rtf1\ansi\ansicpg1252\uc1\htmautsp\deff2{
{\field{\*\fldinst {INCLUDEPICTURE "C:\\\\temp\\\\test.jpg" \\* MERGEFORMAT \\d}}{\fldrslt}}
}}
Code:
TextRange textRange;
System.IO.FileStream fileStream;
if (System.IO.File.Exists(file))
{
textRange = new TextRange(rtb.Document.ContentStart, rtb.Document.ContentEnd);
using (fileStream = new System.IO.FileStream(file, System.IO.FileMode.OpenOrCreate))
{
textRange.Load(fileStream, System.Windows.DataFormats.Rtf);
}
}
When I open the same file in Word, the document and its image is displayed correctly, but in WPF, the richtextbox remains empty. Embedding the image works, but this is no option for us. Any ideas how to get this working in C#/WPF?
Aucun commentaire:
Enregistrer un commentaire