Created
October 26, 2023 14:11
-
-
Save bjoerntx/82fb4eb1e6554dd56939163ca4f8cef0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private bool IsCharacterFormatEqual(Paragraph paragraph, ParagraphStyle paragraphStyle) | |
{ | |
paragraph.Select(); | |
var selection = _textControl.Selection; | |
foreach (var property in typeof(Selection).GetProperties()) | |
{ | |
if (!_positiveListCharacterFormat.Contains(property.Name)) | |
{ | |
continue; | |
} | |
object value1 = property.GetValue(selection); | |
var paragraphStyleProperty = typeof(ParagraphStyle).GetProperty(property.Name)?.GetValue(paragraphStyle); | |
// compare the values | |
if (!object.Equals(value1, paragraphStyleProperty)) | |
{ | |
return false; | |
} | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment