This project has moved and is read-only. For the latest updates, please go here.

How can I remove the current footer?

Jan 15, 2014 at 7:45 AM
hi~
the old docx file has a footer,how can I remove the footer by code?
thank you!
Jan 15, 2014 at 9:41 AM
There's no method that removes the footer, or at least I don't think there is.
As a workaround you could try removing all the paragraphs in the footer(s), though this will keep the first page/even/odd settings while removing page numbering:
foreach (Paragraph p in document.Footers.odd.Paragraphs)
    p.Remove(false);
                
foreach (Paragraph p in document.Footers.even.Paragraphs)
    p.Remove(false);
                
foreach (Paragraph p in document.Footers.first.Paragraphs)
    p.Remove(false);
Jan 17, 2014 at 12:51 AM
HI ~ Annika89:
the code can remove the text,but many new (empty) lines left.