We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How do I get the images out of a sfRichTextAdv control

Thread ID:





131808 Jul 28,2017 04:03 AM UTC Jul 28,2017 12:54 PM UTC UWP 1
Tags: SfRichTextBoxAdv
Lee Davies
Asked On July 28, 2017 04:03 AM UTC

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();
            var stgFile = await fileOpenPicker.PickSingleFileAsync();
            if (stgFile != null)

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.

Venkatesan Mani [Syncfusion]
Replied On July 28, 2017 12:54 PM UTC

Hi Lee Davies,

Thank you for using Syncfusion products.

Our ImageContainerAdv does not preserve file name or mime type when inserting image using InsertPicture command. However we have provided an option to specify HTML export settings from our Essential Studio version v15.2.0.43. Using the event “ImageNodeVisitedEvent” of HtmlImportExportOptions instance, you will have the image data as stream. You can process the stream and specify the image string to be exported in HTML. Please find the release notes and API reference below.




We have prepared a sample using ImageNodeVisited event to process the stream, save it in local storage and specify the path to be exported in HTML Please find the same from the following link.

Sample link:

Try running the sample and let us know if this helps you.

Venkatesan M. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon