Ive been trying to figure out how to obtain information from richtextbox if text is bolded, underlined or italic. So if I read a line from richtextbox, I need to know if some of the words is bolded etc? I dont want to save the contents to .rtf but to another, so that's why I need to know which words are formatted to something so I can add tags before the word to save contents like to .txt file.
Yes, it works if you make it like this
private void Button_Click(object sender, RoutedEventArgs e)
{
foreach (Paragraph p in myRichTextBox.Document.Blocks)
{
foreach (var inline in p.Inlines)
{
if (inline.FontWeight == FontWeights.Bold)
{
// obtain text from p
}
}
}
}
How I can obtain text which is bolded?