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

Free Support Forum - aspose.com

How do I remove the first page but keep the headers and footers

can some one give me some C# code to remove the first blank page from this document but still keep the header and footers in the document. I have manged to get rid of the first page but I loose the header and footers in the rest of the document.

NP Tailgate Transmission Additional Signatures Form.zip (57.4 KB)


Please use the following code example to achieve your requirement. Hope this helps you.

Document doc = new Document(MyDir + "NP Tailgate Transmission Additional Signatures Form.docx");
MergeHeaderFooter(doc.Sections[0], doc.Sections[1], HeaderFooterType.HeaderFirst);
MergeHeaderFooter(doc.Sections[0], doc.Sections[1], HeaderFooterType.FooterFirst);
MergeHeaderFooter(doc.Sections[0], doc.Sections[1], HeaderFooterType.HeaderPrimary);
MergeHeaderFooter(doc.Sections[0], doc.Sections[1], HeaderFooterType.FooterPrimary);
doc.Save(MyDir + "20.8.docx");

public static void MergeHeaderFooter(Section srcSec, Section dstSec, HeaderFooterType headerType)
    HeaderFooter header = dstSec.HeadersFooters[headerType];
    if (header == null)
        // There is no header of the specified type in the current section, create it.
        header = new HeaderFooter(dstSec.Document, headerType);

    foreach (Node srcNode in srcSec.HeadersFooters[headerType].ChildNodes)
        Node dstNode = dstSec.Document.ImportNode(srcNode, true, ImportFormatMode.KeepSourceFormatting);
1 Like