Free Support Forum - aspose.com

Table header issue

Hi

I want a sample code to repeat table headers that spans to multiple pages.

I would like to know whether Aspose.word 9.0/9.1 supports this feature.

It's an immediate requirement for my client.

Please reply ASAP.


This message was posted using Aspose.Live 2 Forum

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

Thanks for your request. Both 9 and 9.1 support HeadingFormat. You can try using code like the following:

//Create document and DocumentBuilder

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

//Create heading row that will be repeated on each page

builder.RowFormat.HeadingFormat = true;

builder.Bold = true;

for (int i = 0; i < 5; i++)

{

builder.InsertCell();

builder.Write(string.Format("heading_{0}", i));

}

builder.EndRow();

builder.RowFormat.HeadingFormat = false;

builder.Bold = false;

//Generate body of table

for (int rowIdx = 0; rowIdx < 100; rowIdx++)

{

for (int colIdx = 0; colIdx < 5; colIdx++)

{

builder.InsertCell();

builder.Write(string.Format("value_of_{0}_{1}", rowIdx, colIdx));

}

builder.EndRow();

}

builder.EndTable();

//Save output document

doc.Save("out.doc");

I hope this could help you.

Best regards,