MoveToHeaderFooter causes an unwanted carriage return character

Hi.

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”.

Thanks.

Hello
Thanks for your request. I cannot reproduce the problem on my side. Could you please attach your code or simple application which will allow me to reproduce the problem on my side? I will check the problem and provide you more information.
Best regards,

Hi

Thanks for the reply. Unfortunately, we’re a bit under pressure right now, and this is not a priority issue, so I won’t be able to do this right now.

I will probably have some time to revisit the issue early next year.

Regards

Hello
Thank you, I will wait for your additional information.
Best regards,

Hi.

I did the test application as you asked, and I found that, though it does add a carriage return, it always sits at the end of the content.

After some more investigation, I discovered that the method I use to implement TabStop changes always insert a new paragraph, and this method gets called whenever I insert net content.

The error was therefore my own. Sorry for wasting your time.

Regards

Hello
Thank you for additional information. It is perfect that you found the reason of the problem. Please let us know in case of any issue, we will be glad to help you.
Best regards,