Hi Franz-Josef,
Thanks for sharing the detail. The last node of document is paragraph break. So, you are getting it in output document. In your case, we suggest you please IReplacingCallback interface as shown below. Hope this helps you.
Moreover, please check the code examples shared in following article.
Find and Replace
class ReplaceEvaluator : IReplacingCallback
{
///
/// This method is called by the Aspose.Words find and replace engine for each match.
///
ReplaceAction IReplacingCallback.Replacing(ReplacingArgs e)
{
if (e.MatchNode.GetText().Contains(ControlChar.LineBreak))
return ReplaceAction.Replace;
return ReplaceAction.Skip;
}
}
Document doc = new Document(MyDir + "Hello.docx");
FindReplaceOptions findreplace = new FindReplaceOptions();
findreplace.ReplacingCallback = new ReplaceEvaluator();
doc.Range.Replace(ControlChar.LineBreak, "" + (char)0x0b, findreplace);
doc.Save(MyDir + "17.3.0.txt");