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

Free Support Forum - aspose.com

Not same headers

Hi !

I try to merge a document several times into one. In the final document, I have only header in the first page, but I want the same header for all pages. I try this :

docSortie.FirstSection.PageSetup.DifferentFirstPageHeaderFooter = false;

but the result is always unchanged. I must to use Aspose.word

Thanks and sorry for my language ^^

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. Please try using the following code:

//Open document

Document doc = new Document(@"Test114\in.doc");

//Copy content from First page Header to primary header if it is not exists

if (doc.FirstSection.HeadersFooters[HeaderFooterType.HeaderPrimary] == null &&

doc.FirstSection.HeadersFooters[HeaderFooterType.HeaderFirst] != null)


HeaderFooter hf = new HeaderFooter(doc, HeaderFooterType.HeaderPrimary);

foreach (Node child in doc.FirstSection.HeadersFooters[HeaderFooterType.HeaderFirst].ChildNodes)






//Loop throuhg all sections

foreach (Section section in doc.Sections)


section.PageSetup.DifferentFirstPageHeaderFooter = false;

if (!doc.FirstSection.Equals(section))



//Save output document


Hope this helps.

Best regards.