Header/Footer behaviour with continuous section break (LinkToPrevious) #1832
Niccober
started this conversation in
Ideas / Requests
Replies: 1 comment 4 replies
-
Interesting observations, I am liking option 1, but I got to re-familiarize myself with the code to fully understand the scope Can you send some sample code I can work with? |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What I want to achieve:
I have some static title content which takes up roughly one half of the first page. After that first half, user-specified content should be added to the document. This content can vary in length so it is not clear when the next page will be needed. I want to have a header/footer for the first page and then different headers/footers for the rest of the document and at the same time I do not want to skip the available space on the first page. So the user-specified content should start already on the second half of page one and whenever the content reaches page two, the headers/footers of the second section should apply.
To achieve this, I inserted a continuous section break after the static title page content, specified the different header/footer styles in the sections array and expected the different header/footer styles to be applied at page two and subsequent pages.
The problem:
When using a continuous section break, the specified headers and footers of the new section are not reflected in the document. Instead, the headers and footers of the previous section (title page) are applied. This is only the case when using a continuous section break, with e.g. next page section break the headers and footers of the new section are applied as expected. But then the available space on the first space would be lost.
This is IMO not a bug of this library, but is rather caused by the default Word behaviour which automatically sets the
Link to previous
option in the header/footer menue (see also MS docs: https://support.microsoft.com/en-us/office/link-to-previous-7b3bb5d6-d7e5-44fe-b2f1-ec71f8d9f193):When looking at the underlying XML, one can see that a new section after a continuous section break does not contain a
headerReference
. I assume that based on the missing reference, Word automatically activates theLink to the previous
option.When creating a word document manually, this problem can be overcome if one adds the continuous section break, then adds multiple paragraphs until page two is showing up and then double clicks in the header/footer section (as shown above) and deactivates the
Link to previous
option. After that, one can style the header/footer of the second section without changing the ones on the first page.Possible solutions:
Of course, if only the first page should look different, one can use the
titlePage
option but IMO it would be a way cleaner approach if the different stylings could be assigned to separate sections in general even when using the continuous section break.I wonder if it would be possible to somehow adjust the library to prevent that behaviour either by
headerReference
in the first place at the section xml when using a continuous section break orLink to the previous
setting before the headers are created (not sure if possible)I would love to hear your opinion on that topic.
Cheers!
Beta Was this translation helpful? Give feedback.
All reactions