/// <summary> /// Compare this instance with a specified RichText. /// </summary> /// <returns></returns> public int CompareTo(RichText other) { // convert rich text first to plain text and compare that string String txt = RichTextConversion.RichTextToString(this); String otherTxt = RichTextConversion.RichTextToString(other); return(txt.CompareTo(otherTxt)); }
/// <summary> /// Remove all formatting, optionally with tabs and line breaks /// </summary> /// <param name="withWhitespaces">true with tabs and line breaks</param> public void RemoveFormats(bool withWhitespaces) { string rtfText = Rtf; Text = string.Empty; if (withWhitespaces) { Text = RichTextConversion.RichTextToStringStripWhitespaces(new RichText(rtfText)); } else { Text = RichTextConversion.RichTextToString(new RichText(rtfText)); } }