I am looking at the ColumnGridReport example for DynamicReports.
I would like to use the classic code syntax instead of the DSL used in the example, meaning creating
JasperReportBuilder report = DynamicReports.report();
and using report.addColumn(...) and so on, but I can’t figure out how to do that for the “columnGrid” part:
report
.columnGrid(
grid.verticalColumnGridList(
itemColumn,
grid.horizontalColumnGridList(quantityColumn, unitPriceColumn)),
grid.verticalColumnGridList(
orderDateColumn,
grid.horizontalColumnGridList(orderDateFColumn, orderYearColumn),
grid.horizontalColumnGridList(orderMonthColumn, orderDayColumn)));
There is a variable grid … where is that even initialized?
Basically I would like to do report.columnGrid(how to initialize the inside part).
How can I transform this to the classic syntax?
Advertisement
Answer
There’s one static import in the file:
import static net.sf.dynamicreports.report.builder.DynamicReports.*;
As you can see in this Javadoc documentation, grid is a static field in DynamicReports.