We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Repeating Table Headers

Hi,

We produce both Word and PDF documents from content defined in HTML. The PDF is generated from the Word document.

From going through the forum it seems that we can use the following (where table is an Aspose.Words.Tables.Table):

table.FirstRow.RowFormat.HeadingFormat = true;

We are setting this property to 'true' for all tables within the document with the following bit of code.

// Table headings

Node currentNode = documentBuilder.CurrentParagraph;

while (currentNode != null)

{

currentNode = currentNode.NextSibling;

if (currentNode != null && currentNode.NodeType == NodeType.Table)

{

Aspose.Words.Tables.Table table = currentNode as Aspose.Words.Tables.Table;

if (table != null)

{

// Vertical

table.FirstRow.RowFormat.HeadingFormat = true;

}

}

}

Unfortunately this doesn't appear to be working for either the rendered Word documents or PDF documents (please refer to the last table in the attachments).

Is there anything else that needs to be done for the use of the HeadingFormat property?

Thanks in advance.

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. Please try using the following code:

// Open document.

Document doc = new Document(@"Test001\Repeating_Header.doc");

// Get all tables.

NodeCollection tables = doc.GetChildNodes(NodeType.Table, true);

// Set "Repeat as header" for each first row in each table.

foreach (Table table in tables)

table.FirstRow.RowFormat.HeadingFormat = true;

// Save output as DOC and PDF

doc.Save(@"Test001\out.doc");

doc.Save(@"Test001\out.pdf");

Hope this helps.

Best regards.

Thanks Alexey. Your approach has resolved the issue.