We’re building up a document from scratch, and I’ve noticed that an unwanted “\r” is added to the header, footer and body of each section. After carefully stepping through my code, I finally found the culprit.
When I’m on the _docBuilder.MoveToHeaderFooter(HeaderFooterType.HeaderFirst); line, and run _docBuilder.CurrentParagraph.GetText() in the watch window, I get “\f”. When I execute the MoveToHeaderFooter line, and rerun the watch window statement, I get “\f\r”.
From my fiddling around, I get the impression that the docBuilder does not store this character, and only adds it when you output it as text.
I’m looking for a way to either prevent this characted from being added in the first place, or, barring that, some way of removing it after I called “MoveToHeaderFooter”.