I have problems rendering table with large cell values. This is inside a web application. Is there any setting required to allow large values. Basically, the whole table is not rendered. Following is the code snippet
// create table
PdfPTable datatable = new PdfPTable(9);
int headerwidths[] = {11, 11, 11, 11, 11, 11, 11, 11, 11};
datatable.setWidths(headerwidths);
datatable.setWidthPercentage(100); // percentage
datatable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
datatable.setWidths(headerwidths);
datatable.setWidthPercentage(100); // percentage
datatable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
// set column names
for (int i = 0; i < 9; i++){
PdfPCell cell = new PdfPCell( new Phrase("colname",
new Font (Font.HELVETICA, 11, Font.BOLD)));
cell.setBackgroundColor(Color.gray);
datatable.addCell(cell);
new Font (Font.HELVETICA, 11, Font.BOLD)));
cell.setBackgroundColor(Color.gray);
datatable.addCell(cell);
}
// add cell values
// construct a string value that is large to populate in the cell
String value = "";
for (int i = 0; i < 500; i++){
value += "a";
}
for (int i = 0; i < 5; i++){
datatable.addCell("r" + i + "c1" + value);
datatable.addCell("r" + i + "c2");
datatable.addCell("r" + i + "c3");
datatable.addCell("r" + i + "c4");
datatable.addCell("r" + i + "c5");
datatable.addCell("r" + i + "c6");
datatable.addCell("r" + i + "c7");
datatable.addCell("r" + i + "c8");
datatable.addCell("r" + i + "c9");
}
for (int i = 0; i < 500; i++){
value += "a";
}
for (int i = 0; i < 5; i++){
datatable.addCell("r" + i + "c1" + value);
datatable.addCell("r" + i + "c2");
datatable.addCell("r" + i + "c3");
datatable.addCell("r" + i + "c4");
datatable.addCell("r" + i + "c5");
datatable.addCell("r" + i + "c6");
datatable.addCell("r" + i + "c7");
datatable.addCell("r" + i + "c8");
datatable.addCell("r" + i + "c9");
}
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
