You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to manually override the Link to Previous flag on a header/footer?
Say we have two documents, both with headers/footers.
Document1
Document2
After inserting a Document2 into a Document1, the header/footer that came from the Document2 is replaced by the last header/footer from Document1.
I know there's an open issue regarding merging documents with different headers/footers. I was hoping to temporarily override the header/footer in the last section. However, because it is Linked to Previous, it ends up removing the header/footer values from the last section of Document1.
Here's a sample of the code I'm trying to run...
Dim document = Xceed.Words.NET.DocX.Load("")
document.InsertSectionPageBreak()
Dim document2 = Xceed.Words.NET.DocX.Load("")
document.InsertDocument(document2)
Dim section = document.Sections(document.Sections.Count - 1)
For Each paragraph In section.Footers.First.Paragraphs
paragraph.Remove(False)
Next
For Each paragraph In section.Footers.Even.Paragraphs
paragraph.Remove(False)
Next
For Each paragraph In section.Footers.Odd.Paragraphs
paragraph.Remove(False)
Next
document.Save()
The footer is successfully removed, but it's also removed from the prior pages where I wish to keep it intact.
The text was updated successfully, but these errors were encountered:
I was able to work around this issue by using the following...
Dim document = Xceed.Words.NET.DocX.Load("")
document.InsertSectionPageBreak()
Dim document2 = Xceed.Words.NET.DocX.Load("")
document.InsertSection()
document.Sections(document.Sections.Count - 1).AddHeaders()
document.Sections(document.Sections.Count - 1).AddFooters()
document.InsertSection()
document.InsertDocument(document2)
document.Save()
I can now attach Document2 to Document1 without Document1 headers/footers appearing at the end of Document1.
This does prevent Document2s headers/footers from showing, which is fine for what I needed.
Is there a way to manually override the Link to Previous flag on a header/footer?
Say we have two documents, both with headers/footers.
Document1
Document2
After inserting a Document2 into a Document1, the header/footer that came from the Document2 is replaced by the last header/footer from Document1.
I know there's an open issue regarding merging documents with different headers/footers. I was hoping to temporarily override the header/footer in the last section. However, because it is Linked to Previous, it ends up removing the header/footer values from the last section of Document1.
Here's a sample of the code I'm trying to run...
The footer is successfully removed, but it's also removed from the prior pages where I wish to keep it intact.
The text was updated successfully, but these errors were encountered: