Я пытаюсь добавить другой нижний колонтитул после добавления каждого altchunk. Но мой код меняет все нижние колонтитулы и на последней странице есть два нижних колонтитула. Я добавляю разрыв раздела перед добавлением нового нижнего колонтитула с другим текстом. (C # и OpenXml)
public static void AppendFooter(string sFtText, string sFile)
{
using (WordprocessingDocument wdDoc = WordprocessingDocument.Open(sFile, true))
{
MainDocumentPart myPart = wdDoc.MainDocumentPart;
FooterPart newFtPart = myPart.AddNewPart<FooterPart>();
string ft_ID = myPart.GetIdOfPart(newFtPart);
MakeFooterPart(sFtText).Save(newFtPart);
foreach (SectionProperties sectProperties in
myPart.Document.Descendants<SectionProperties>())
{
FooterReference newFtReference =
new FooterReference() { Id = ft_ID, Type = HeaderFooterValues.Default };
sectProperties.Append(newFtReference);
}
// Save the changes to the main document part.
myPart.Document.Save();
}
}
////////////////////////////////////////////
private static Footer MakeFooterPart(string FooterText)
{
var element =
new Footer(
new Paragraph(
new ParagraphProperties(
new ParagraphStyleId() { Val = "Footer" }),
new Run(
new Text(FooterText))
)
);
return element;
}