DynamicReports dont print column header at page start

505 views Asked by At

Because of some issue with highlighting rows, I added following column header to my report:

addColumnHeader(
        cmp.filler().setStyle(stl.style().setTopBorder(stl.pen1Point())).setFixedHeight(1))

This solves my issue, but now I always have a Line at the top of each page. What do I need to do, to only display the column header part for each group, but not at page start?

I already use setShowColumnTitle(false) to not display the column titles at page start, but this doesn't work for the column header. Also I couldn't find a way to add anything to the column title band which would be hidden due to setShowColumnTitle(false)

1

There are 1 answers

0
XtremeBaumer On

I was able to hide the column header component by adding a setPrintWhenExpression to the filler component.

addColumnHeader(cmp.filler().setStyle(stl.style().setTopBorder(stl.pen1Point())).setFixedHeight(1)
       .setPrintWhenExpression(new ColumnHeaderExpression()));

and the ColumnHeaderExpression only returns true, if the page number is -1 which will never happen.

private class ColumnHeaderExpression extends AbstractSimpleExpression<Boolean> {
    private static final long serialVersionUID = 1L;

    public ColumnHeaderExpression() {
    }

    @Override
    public Boolean evaluate(ReportParameters reportParameters) {
        return reportParameters.getPageNumber() == -1;
    }
}

And with this the column header never prints at the start of each page, but still prints at the start of each group, which is exactly what I needed.