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

Free Support Forum - aspose.com

How to add pagebreak

Hi ,

I am creating word document by using HTML stream insertHtml()

I created one template file which first page is a cover page and rest all pages contains information


I want to add Header and footer not on first page but rest of all pages.

so how to do that how to add page break using HTML stream

or any other logic to do this.

Regards ,
Jeevan Joshi.

Hi Jeevan,


Thanks for your inquiry. In your case, I suggest you to use PageSetup.DifferentFirstPageHeaderFooter property. True if a different header or footer is used on the first page. Following code example creates headers and footers different for first, even and odd pages using DocumentBuilder. Hope this helps you. Please let us know if you have any more queries.

DocumentBuilder builder = new DocumentBuilder();<o:p></o:p>

PageSetup ps = builder.PageSetup;

ps.DifferentFirstPageHeaderFooter = true;

ps.OddAndEvenPagesHeaderFooter = true;

builder.MoveToHeaderFooter(HeaderFooterType.HeaderEven);

builder.Writeln("Even pages header.");

builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);

builder.Writeln("Odd pages header.");

// Move back to the main story of the first section.

builder.MoveToSection(0);

builder.Writeln("Text page 1.");

builder.InsertBreak(BreakType.PageBreak);

builder.Writeln("Text page 2.");

builder.InsertBreak(BreakType.PageBreak);

builder.Writeln("Text page 3.");

builder.Document.Save(MyDir + "PageSetup.DifferentHeaders Out.doc");