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

Free Support Forum - aspose.com

Problems with tables and PDF

Dear Aspose team,

I have some trouble with tables in Aspose.Words 10.1 (Java):

  1. Cell texts are correctly wrapped when setting fitText = true (long words are split in to multiple lines, even if there is no white space). But when saving the document to PDF, the cells are growing and the table becomes too wide.
  2. Cell text with many rows flow out of the page and don’t continue on the following pages. I assumend setting allowBreakAcrossPage in the row format should helped, but I didn’t see any difference. Am I doing anything wrong?
  3. And last but not least: Is there a way to repeat a table header on each page?

Thanks for your help + best regards,


Thanks for your inquiry.

1. Could you please provide me the code which will allow me to reproduce the problem on my side?

2. Regarding how to avoid tables splitting across the page, please try setting the ParagraphFormat.KeepWithNext property for each paragraph inside the table. This will cause the entire table to keep together across a page break.

3. In this case you should use HeadingFormat property.

Please see the following code for example:

//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.Write(string.Format("heading_{0}", i));



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.Write(string.Format("value_of_{0}_{1}", rowIdx, colIdx));





//Save output document


I think it should be easy for you to translate this code to Java. Please let me know in case of any issues.

I hope this could help you.

Best regards,


thanks for your quick reply! I will try your tips and send you an example for #1 tomorrow.

Just a comment about #2: The cell in my document is too large to fit on a single page. Therefore I want the cell to be split and the rest to be shown on the following page. Unfortunally it only shows the content fitting on page one - the rest overflows and becomes invisible.

Is there any way to archieve this?


Sry, seeing you example I found the reason for #2 and #3: I didn’t reset the header property of the RowFormat. Then the table doesn’t repeat the headers (of course) and cuts overflowing text.



Thank you for additional information. It is perfect that you managed to resolve the 2nd and 3rd issue. Regarding the 1st one, this is expected behavior. You will get the same result if set this option in MS Word. Please see the attached screenshot.

Best regards,