I have a complex document created in the SfRichTextBoxAvd and I want to pull all the images from the document.
I added the image to the SfRichTextBoxAvd using the following code
private async void InsertPictureButton_Click(object sender, RoutedEventArgs e)
{
var fileOpenPicker = new FileOpenPicker();
fileOpenPicker.FileTypeFilter.Add(".png");
fileOpenPicker.FileTypeFilter.Add(".jpg");
var stgFile = await fileOpenPicker.PickSingleFileAsync();
if (stgFile != null)
{
RichTextBoxAdv.InsertPictureCommand.Execute(stgFile);
}
}
I can get the ImageContainerAdv from the SfRichTextBoxAvd using the following code
foreach (SectionAdv section in RichTextBoxAdv.Document.Sections)
{
foreach (ParagraphAdv block in section.Blocks)
{
foreach (var inline in block.Inlines)
{
if (inline is ImageContainerAdv imageContainer)
{
imageContainer gives me the ImageSource and the ImageString (the latter is always empty).
However I cannot get the image content or any of the metadata associated with the image (file name and image mime type) from the imageContainer
My fallback is to convert the contents to html and then pull the base64 image from the img tags, however this feels like a kludge and does not get me the original file name.