This is a migrated thread and some comments may be shown as answers.

[Solved] RadRichText Box and MsRichTextBoxXaml

1 Answer 118 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Don
Top achievements
Rank 1
Don asked on 29 Jul 2011, 05:36 AM
How do you open a Word Document containing images and exclude the images when the the Rich Texbox is opened? I know you have a format provider named Telerik.Windows.Documents.FormatProviders.MsRichTextBoxXaml.dll which removes images, but I don't know where to wire this when a document is opened.

1 Answer, 1 is accepted

Sort by
0
Accepted
Ivailo Karamanolev
Telerik team
answered on 03 Aug 2011, 09:22 AM
Hi Don,

Using MsRichTextBoxXamlFormatProvider will not be optimal, but fortunately, I can recommend a much easier way that will preserve all formating, stripping the images only. Here's a code snippet how you can perform that operation on a RadDocument. You can see how to load the document in the help on format providers.
foreach (ImageInline imageInline in document.EnumerateChildrenOfType<ImageInline>().ToArray())
{
    imageInline.Parent.Children.Remove(imageInline);
}
 
foreach (FloatingImageBlock floatingImageBlock in document.EnumerateChildrenOfType<FloatingImageBlock>().ToArray())
{
    floatingImageBlock.Parent.Children.Remove(floatingImageBlock);
}
Let us know if you need additional assistance.

Regards,
Ivailo
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Tags
RichTextBox
Asked by
Don
Top achievements
Rank 1
Answers by
Ivailo Karamanolev
Telerik team
Share this question
or