Hi
Thanks for your request. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is resolved.
As a temporary workaround, you can try using the following code:
// Open source document.
Document doc = new Document(@"Test001\in.rtf");
// Loop through all sections.
foreach(Section section in doc.Sections)
{
// Create list, where we will temporary store headers/footers.
ArrayList hfList = new ArrayList();
foreach(HeaderFooter headerFooter in section.HeadersFooters)
{
// Create copy of the header/footer.
HeaderFooter hfNew = new HeaderFooter(doc, headerFooter.HeaderFooterType);
// Copy all content from old header footer.
foreach(Node node in headerFooter.ChildNodes)
hfNew.AppendChild(node);
hfList.Add(hfNew);
}
// Remove old headers/footes.
section.HeadersFooters.Clear();
// Add new headers/footers.
foreach(HeaderFooter headerFooter in hfList)
section.HeadersFooters.Add(headerFooter);
}
// Save output document.
doc.Save(@"Test001\out.doc");
Hope this helps.
Best regards.