report.setReportHeader(new ReportHeader());
report.setReportFooter(new ReportFooter());
report.setPageHeader(initPageHeader("SubReport " + columnsPerPage));
report.setPageFooter(new PageFooter());
ItemBand items = report.getItemBand();
items.getStyle().setStyleProperty(ElementStyleKeys.BACKGROUND_COLOR, Color.lightGray);
items.setName("Items");
ContentFieldElementFactory tfFactory = new ContentFieldElementFactory();
items.getStyle().setFontDefinitionProperty(HEADER_FONT);
float[] columnPos =
new float[]{0.0f, 60.0f, 120.0f, 184, 248, 313, 377, 442};
float[] columnWidth = new float[]{60, 60, 64, 64, 64, 64, 64, 64};
int cellHeight = 12;
for (int i = 0; i < tm.getColumnCount(); i++)
{
tfFactory.setMinimumSize(new FloatDimension(columnWidth[i] - 4,
cellHeight));
tfFactory.setAbsolutePosition(new Point2D.Float(columnPos[i] + 2, 0));
tfFactory.setFieldname(tm.getColumnName(i));
items.addElement(tfFactory.createElement());
}
return report;
}