We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Header and footer lost after replace with section break


We are using the Range.Replace method to replace text in our documents. One of the features provided by the find and replace API is the ability to replace text with metacharacters.

We are experiencing problems when using the SectionBreak (&b) meta character in combination with headers and/or footers. If this character is used the header and/or footer will be removed from the first section and fixed to the second section.

I can’t quite get a grip if this is by design or not. My expectation is that the original header and footer stays on the original section and the header and footer of the new section is ‘linked to previous’ since this is a newly created section?

Please find source code below.

DocumentBuilder builder = new DocumentBuilder(document);


builder.Writeln("Section One[break]Section Two");
document.Range.Replace("[break]", "&b");


We have logged this problem in our issue tracking system. Your ticket number is WORDSNET-22353. We will further look into the details of this problem and will keep you updated here on the status. We apologize for any inconvenience.

The issues you have found earlier (filed as WORDSNET-22353) have been fixed in this Aspose.Words for .NET 21.8 update and this Aspose.Words for Java 21.8 update.