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

Free Support Forum - aspose.com

Can't Insert Section without Headers and Footers


I am unable to insert a blank section (without headers/footers or page numbers) into a document that has headers and footers. I have a document with consecutive sections, each with separate headers, footers and page numbering. I want to insert a section in between that renders as a blank page.

I've tried several different ways of doing this, including manually removing the headers and footers, etc. but nothing seems to work.

Here is the desired layout:

  • Cover page
  • Blank page
  • Table of Contents page
  • Blank page *add this page*
  • Remaining pages

I've attached a simple test program and document.



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

Thanks for your request. Please try using the following Code:

namespace Remove_Header_Footer


class TOCVisitor : DocumentVisitor


public override VisitorAction VisitFieldEnd(FieldEnd fieldEnd)


if (fieldEnd.FieldType == FieldType.FieldTOC) {

//Create DocumentBuilder

DocumentBuilder builder = new DocumentBuilder(fieldEnd.Document);

//Move to the end of paragraph that contains TOC field


//Insert Section break


//Unlink Header/Footer


return VisitorAction.Stop;


return VisitorAction.Continue;




Hope this helps.

Best regard.