Header and Footer being repeated

Hello, 

When I create a new section, I am using:

 section.HeadersFooters.LinkToPrevious = false;

However, the header and footer from the first section are being repeated on the second section so the second section is displaying with multiple headers and footers. How can I show only one header and footer per section? 



4 Replies

NW Natalie Westphal January 3, 2024 06:09 PM UTC

Hello,

Checking in to see if there is a solution for this. Thanks. 



BS Balamurugan Shanmugam Syncfusion Team January 4, 2024 07:08 AM UTC

Hi Natalie,

As per MS Word behavior, by default, we can't turn off the link to previous in a single section. And also the other behavior: if we turn off linking to previous in the second section, in that case, section section has only link to previous false. When we turn off the link to previous sections, only the link is broken, but the contents of previous sections are displayed. The same behavior exists in MS Word as well as in documentEditor. So, we considered this valid behavior in documentEditor. Please find attached a video for your reference.


Regards,

Balamurugan S


Attachment: LinkToPrevious_e4fcbcec.zip


NW Natalie Westphal January 4, 2024 05:36 PM UTC

So by this logic, it is not possible to have different headers on multiple sections of the report? 

Is it possible to clear the existing header on Section 2 before adding the new header? For example, when section 2 is created the header line "Section 1" is deleted programatically before adding "Section 2"? 



BS Balamurugan Shanmugam Syncfusion Team January 5, 2024 11:27 AM UTC

Hi Natalie,

As per behavior, by default, the header and footer content are repeated in the following section. Currently, documentEditor doesn't have any built-in function to clear an existing header before adding a new header. You can define this use case to create an empty header and footer for all the sections. Once all the sections are created, you can populate the data based on the header and footer. If the mentioned solution is against your workflow, otherwise, you can achieve this requirement by deleting the content manually, as shown below.

  • Add custom toolbar options for inserting section breaks instead of the built-in option.
  • Once the section break is inserted, go to the header and footer.
  • Use the selectAll API and delete API to delete all the existing content in the header and footer.

[Limitations: deleted content is preserved in the history of the undo stack.]

Please find below a sample and video for your reference.

Sample - U7943r (forked) - StackBlitz

Regards,

Balamurugan S


Attachment: linkHeaderfooter_472d29e3.zip

Loader.
Up arrow icon