Multiple Table Header Rows

I am currently working on word document where I have a table with long set of rows spanning over multiple pages. The table is in the format as below.


MAINCATEGORY1
SubCategory 1
Data 1
Data 2
Data 3
SubCategory 2
Data 1
Data 2
Data 3
MAINCATEGORY2
SubCategory 1
Data 1
Data 2
Data 3

This is a single table and I am cloning rows separately(MainCategoryRow,SubCategoryRow and ContentRow). When teh page break occurs it is keeping the MAINCATEGORY as the page header eventhough current Main Category header may be MAINCATEGORY3. I have used teh below property when I am setting each MainCategory row.

MainRow.RowFormat.HeadingFormat = true;
tableNode.Rows.Add(MainRow);

Expectation: When the new page starts if data is from MAINCATEGORY3 then the page header should MAINCATEGORY3 .

Please help me how to achieve functionality.

Hi there,

Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output Word file that shows the undesired behavior.
  • Please manually create your expected output Word document using Microsoft Word and attach it here.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we'll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip them and Click 'Reply' button that will bring you to the 'reply page' and there at the bottom you can include any attachments with that post by clicking the 'Add/Update' button.