Hi,
I am creating Rtf file by using aspose words.
Please find the attachments.
If table contains more then 20 columns , the table column cells width alignment is not properly.
This is my code.
" Table table = builder.startTable();
builder.getCellFormat().clearFormatting();
builder.getCellFormat().setWidth(100);
for (Map<String,Object> map: columns) {
insertCell(builder);
builder.getCellFormat().getShading().setBackgroundPatternColor(Color.YELLOW);
builder.getCellFormat().setWidth(100);
builder.write((String) map.get(“columnName”));
}
builder.endRow();
for (Map<String,Object> map: columns) {
String colName = (String) map.get(“columnName”);
colName = colName.toUpperCase().replaceAll(" “, “_”);
insertCell(builder);
builder.getCellFormat().getShading().setBackgroundPatternColor(Color.WHITE);
builder.getCellFormat().setWidth(100);
builder.write(”{{"+colName+"}}");
}
table.setCellSpacing(1);
builder.endTable();"
Above code generates rtf file but columns are alignment is not properly.
My requirement is :
1. I want to increase the page width automatically based on table and columns names width.
2. All columns names should come in one line
3. Suppose if table contains 100 columns with large column names then page size need to increase automatically and all columns should come in one single line not in multiple lines, and also header size also need to increase up to page size.
Please provide the code related to my requirement.