How can I remove the current footer?

Jan 15, 2014 at 6:45 AM
hi~
the old docx file has a footer,how can I remove the footer by code?
thank you!
Jan 15, 2014 at 8: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 16, 2014 at 11:51 PM
HI ~ Annika89:
the code can remove the text,but many new (empty) lines left.