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

Get content of highlighted text

1 Answer 27 Views
Buttons
This is a migrated thread and some comments may be shown as answers.
arab
Top achievements
Rank 1
arab asked on 18 Nov 2016, 04:11 PM

Hello,

I want to use telerik toolbar with radrichtextbox, i want to import word document and highlight with the tollbar button a number of words.

Then i want to get the content of theese words and to save it in an xml file.

Question : How can i get the content of highlited text ? If you know another technology that can provides me with those features please tell me about it.

Thank you.

1 Answer, 1 is accepted

Sort by
0
Tanya
Telerik team
answered on 23 Nov 2016, 01:59 PM
Hello Arab,

You can check all the spans in the document and extract the text from the ones with a particular highlight color. The following snippet demonstrates how you can get the text from the highlighted with red color:
List<string> highlightedStrings = new List<string>();
 
foreach (var span in this.radRichTextBox.Document.EnumerateChildrenOfType<Span>())
{
    if (span.HighlightColor == Colors.Red)
    {
        highlightedStrings.Add(span.Text);
    }
}

Hope this helps.

Regards,
Tanya
Telerik by Progress
Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
Tags
Buttons
Asked by
arab
Top achievements
Rank 1
Answers by
Tanya
Telerik team
Share this question
or