We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

print the header on the new page for the table again, when the page breaks.How

print the header on the new page for the table again, when the page breaks.How ?

4 Replies

MV mvxyc September 22, 2016 07:55 AM UTC

plus some custom header on each page word breaks before the table starts


PE Priyanga Elangovan Syncfusion Team September 23, 2016 05:41 AM UTC

Hi Customer,

Thank you for contacting Syncfusion support.

Regarding “print the header on the new page for the table again, when the page breaks.How ?
”:
As per your requirement, to repeat the header row content automatically when the table breaks the pages kindly set the table.Rows[0].IsHeader property as true. For your reference please refer the below code snippet.

Code Snippet:
 
//Loads the template document
WordDocument wordDocument = new WordDocument("template.docx");
//Gets the table in the document
WTable table = wordDocument.LastSection.Tables[0] as WTable;
//Sets the IsHeader property of first row in the table as true
table.Rows[0].IsHeader =
true;
//Saves the document
wordDocument.Save(
"output.docx"); 

Regarding “plus some custom header on each page word breaks before the table starts”:
It is not possible to set the custom header on each page before the table starts using DocIO. If your requirement is to have different header row for each page, kindly insert the new table on each page and define the header row for each table as per your requirement.

Regards,
Priyanga.E
 



FI Faisal Iqbal October 11, 2019 04:36 PM UTC

Hi,

I am trying to do the same using Table Properties dialog but the option is disabled.
Can you please guide me how to get this option enabled.

 

Thanks,
Faisal  Iqbal



PR Poorani Rajendran Syncfusion Team October 14, 2019 12:24 PM UTC

 Hi Faisal,

Thank you for your update.

We have analyzed the given screenshot, we suspect that you have enabled the option (“Repeat as header row at the top of each page”) for first row alone in the table and then you have tried to enable this same option for second row or rest of the rows in the table separately. So, this option is not enabled at your side.

To enable this option, we suggest you follow the below things,
1. Select the number of rows which you wish to enable this option.
2. Right click the rows and select table properties.
3. Check this option to enable first two rows as table header and then click OK.

We have prepared a video illustration for enabling this option for first two rows in the table and it can be downloaded from the below link:
https://www.syncfusion.com/downloads/support/forum/126079/ze/VideoIllustration-1888834418

As per said in our earlier update (Updated on 9/23/2016), you can enable this option programmatically using Essential DocIO. To enable this option programmatically, we suggest you set the table.Rows[0].IsHeader and table.Rows[1].IsHeader property as true. Please use the below highlighted code snippet in your sample application.

//Loads the template document
WordDocument wordDocument = new WordDocument("template.docx");
//Gets the table in the document
WTable table = wordDocument.LastSection.Tables[0] as WTable;
//Sets the IsHeader property of first and second row in the table as true
table.Rows[0].IsHeader = true;
table.Rows[1].IsHeader = true;
//Saves the document
wordDocument.Save("output.docx");

Please refer the below UG documentation link to know more about specifying table header in Word document using DocIO:
https://help.syncfusion.com/file-formats/docio/working-with-tables#specifying-table-header-row-to-repeat-on-each-page

Please let us know if you have any other questions.

Regards,
Poorani Rajendran
 


Loader.
Live Chat Icon For mobile
Up arrow icon