we are using the following code to add tables to a a word document that is being saved as a pdf:
Table wordTable = builder.startTable();
builder.getCellFormat().getBorders().setLineStyle(LineStyle.SINGLE);
builder.getRowFormat().setAllowBreakAcrossPages(false);
int intTableCols = 4;
double[] dColWidth = {72,144,72,144};
//Write out the header row for the number of configured columns.
for (int i = 0; i < intTableCols; i++) {
//System.out.println("Hey we are in the for loop:"+i);
builder.insertCell();
builder.getCellFormat().setWidth(dColWidth[i]);
}
//End Table Header Row
builder.endRow();
wordTable.setAllowAutoFit(true);
wordTable.autoFit(AutoFitBehavior.FIXED_COLUMN_WIDTHS);
//Write out the content row for the number of configured columns.
for (int i = 0; i < intTableCols; i++) {
<a class="attachment"
builder.insertCell();
}
//End Table content Row
builder.endRow();
If the LAST column size is LARGER than the previous column size then the table sets ALL of the columns in the table to the last column size.
If the LAST column size is SMALLER than the previous column size then the table sets the columns to the specified widths. Supplying to pdf out put with this code.
One with the last column set to 144 and on with the last column set to 72.
Smalleraspose_Word_content_documentbuilder.pdf (14.6 KB)
aspose_Word_content_documentbuilder.pdf (13.8 KB)