Hello there!
I have a problem in applying the styles to my word document. Let me explain in an example:
I have the text: “sometext… sometext replaced text”. Then I replace some old text with new, and finally apply new formatting to new text.
The problem is that new formatting applies not properly. It affects a bit more piece than I expected.
Result: “sometext… sometext replaced text”, but I need ““sometext… sometext replaced text””
There is my Replacer:
ReplaceAction IReplacingCallback.Replacing(ReplacingArgs e)
{
Node currentNode = e.MatchNode;
string value = ((Run)currentNode).Text;
currentNode.Range.Replace(oldValue, newValue, true, true);
if (value.Contains(oldValue))
{
var run = ((Run)currentNode);
run.Text = value.Replace(oldValue, newValue);
run.Font.HighlightColor = richText.HighlightColor;
}
return ReplaceAction.Skip;
}
How can I solve my issue.
Thank you.