Hi Vinay,
Thanks
for your inquiry. Please use the following code example to achieve your requirements. Hope this helps you.
Document doc = new Document(MyDir + "My_Haigh.doc");
foreach (Section section in doc.Sections)
{
if (section.HeadersFooters[HeaderFooterType.HeaderPrimary] == null && section.HeadersFooters[HeaderFooterType.HeaderFirst] != null)
CopyHeaderFooter(doc.FirstSection, HeaderFooterType.HeaderFirst, HeaderFooterType.HeaderPrimary);
if (section.HeadersFooters[HeaderFooterType.FooterPrimary] == null && section.HeadersFooters[HeaderFooterType.FooterFirst] != null)
CopyHeaderFooter(doc.FirstSection, HeaderFooterType.FooterFirst, HeaderFooterType.FooterPrimary);
}
doc.Save(MyDir + "Out.txt", SaveFormat.Text);
Moreover, HeaderFooter class represents a container for the header or footer text of a section. HeaderFooter can contain Paragraph and Table child nodes.
HeaderFooter is a section-level node and can only be a child of Section. There can only be one HeaderFooter or each HeaderFooterType in a Section.
If Section does not have a HeaderFooter of a specific type or the HeaderFooter has no child nodes, this header/footer is considered linked to the header/footer of the same type of the previous section in Microsoft Word.
When HeaderFooter contains at least one Paragraph, it is no longer considered linked to previous in Microsoft Word.