Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Repeat Table Rows as Header

Word Processing Document API offers two options to control the appearance of large tables that span across multiple pages:

The code sample below toggles Repeat row as header and Break row across pages options in code:

View Example

using (RichEditDocumentServer wordProcessor = new RichEditDocumentServer())
{
    AdjustTableRows(wordProcessor.Document);

    wordProcessor.SaveDocument("DocumentWithTables.docx",
         DocumentFormat.OpenXml);
}

private static void AdjustTableRows(Document document)
{
    Table table = document.Tables[0];
    table.BeginUpdate();

    //Repeat first three rows as header:
    table.Rows[0].RepeatAsHeaderRow = true;
    table.Rows[1].RepeatAsHeaderRow = true;
    table.Rows[2].RepeatAsHeaderRow = true;

    //Break last row across pages:
    table.LastRow.BreakAcrossPages = true;
    table.EndUpdate();
}