There are two ways to accomplish the export of the document without the images.
The first one is to create a copy of the document, iterate through it deleting the images and export the result. Using this approach, you can remove the images from the paragraph using the document collection like this:
The second option is not to create a copy of the document and delete the images in the editor. The time for copying the document will be spared, but you will have to delete the images using the Delete method of RadRichTextBox in order to preserve the history. This can be done like this:
IEnumerable<FloatingImageBlock> floatingImageBlocks =
DocumentPosition start =
DocumentPosition end =
InlineLayoutBox inlineLayoutBox = imageBlock.FirstLayoutBox
InlineLayoutBox nextLayoutBox = inlineLayoutBox.AssociatedInline.NextSibling.FirstLayoutBox
You can execute this code in a save command you have created and wired the UI to work with. After the export is complete, you can undo the changes:
i = 0; i < deletedImages; i++)
This method for deleting the images is slower because RadRichTextBox creates contexts for the execution of the commands in order to be able to undo and redo the changes to the document. Furthermore, the
You can choose which method will be more appropriate in your application depending on the size of the documents and the number of floating images that will normally be present in the document.
All the best,
the Telerik team
Sharpen your .NET Ninja skills
! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>