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

Free Support Forum - aspose.com

Section Break delete Header and Footer, MS Word, C#

I have a word template like


<<if [false]>> Test ----Section Break (Next Page)------


In case if is true, everything fine, after rendering i could see the headers, test text —section break—, and footers.
In case if is false, after rendering, I don’t see test text, which is as expected, BUT!!! i also don’t see the Header and Footer - which seems like a bug.

Do you agree about the bug or Could you please give a solution how to overcome.
Thank you.

@evjeebyxcmnxvsuqsb This is not a bug. Section break is not a simple character this is a delimiter of sections in the document. See Aspose.Words Document Object Model for more information. Each section in MS Word document can have its own page setup and headers/footers. When you build a report with the provided syntax content of the current section is prepended to the next section and if headers/footers of the next section is inherited from the previous section, they will be lost. So this is an expected behavior. I have created a simple template that demonstrates this: in.docx (17.0 KB) out.docx (10.9 KB)
As you can see headers/footers in the template are not linked to previous section and they are preserved.