public void RemoveFooters()
{
//ExStart
//ExFor:Section.HeadersFooters
//ExFor:HeaderFooterCollection
//ExFor:HeaderFooterCollection.Item(HeaderFooterType)
//ExFor:HeaderFooter
//ExFor:HeaderFooterType
//ExId:RemoveFooters
//ExSummary:Deletes all footers from all sections, but leaves headers intact.
Document doc = new Document(MyDir + "HeaderFooter.RemoveFooters.doc");
foreach (Section section in doc)
{
// Up to three different footers are possible in a section (for first, even and odd pages).
// We check and delete all of them.
HeaderFooter footer;
footer = section.HeadersFooters[HeaderFooterType.FooterFirst];
if (footer != null)
footer.Remove();
// Primary footer is the footer used for odd pages.
footer = section.HeadersFooters[HeaderFooterType.FooterPrimary];
if (footer != null)
footer.Remove();
footer = section.HeadersFooters[HeaderFooterType.FooterEven];
if (footer != null)
footer.Remove();
}
doc.Save(MyDir + @"\Artifacts\HeaderFooter.RemoveFooters.doc");
//ExEnd
}