The following code will fail with exception message "Object reference not set to an instance of an object."
DocX doc = DocX.Create(@"LineBreakTest.docx");
Paragraph p = doc.InsertParagraph();
string originalText = "TO:\n $Customer.Name,";
string replaceText = "TO:\n John Smith,";
p.ReplaceText(originalText, replaceText, false);
This error only occurs when there is a line break "\n" in the text.
I've tried appending the new text and then removing the original text but this also fails on the remove, additionally trying to replace the "\n" on their own first also fails.