intive-FDV / DynamicJasper

Dynamic Reports using Jasper Reports
http://intive-fdv.github.io/DynamicJasper/
GNU Lesser General Public License v3.0
244 stars 128 forks source link

Merged blank row at the end of first page #114

Open MarcioJrios opened 3 years ago

MarcioJrios commented 3 years ago

I'm using DynamicJasper to export my reports to .xls files. It works fine, but there's something that's bothering me. Although the setIgnorePagination is set to true, at the end of what would be the first page there is a blank row that is merged with the start of the second page.

130962781-3ea7ae0c-0e72-4f1e-9ffd-2236a433b50e

it doesn't affect the values of cells or the use of functions on the columns, but it is unsetling.

Bellow is the report generator and filler calls:

`jr = DynamicJasperHelper.generateJasperReport(pais != null ? buildReport(pais) : buildReport(), getLayoutManager(), params);

    log.debug("Filling the report");
    if (ds != null)
        jp = JasperFillManager.fillReport(jr, params, ds);
    else
        jp = JasperFillManager.fillReport(jr, params);

    log.debug("Filling done!");
    log.debug("Exporting the report (pdf, xls, etc)");
    log.debug("test finished");

    return exportReport();`

And here is my reportBuilder code:

`DynamicReportBuilder drb = new DynamicReportBuilder(); Style columDetail = new Style(); columDetail.setBorder(Border.THIN()); Style detailStyle = new Style(); detailStyle.setBorder(Border.THIN());

    Style valorStyle = new Style();
    valorStyle.setBorder(Border.THIN());
    valorStyle.setHorizontalAlign(HorizontalAlign.RIGHT);
    valorStyle.setVerticalAlign(VerticalAlign.MIDDLE);
    Style headerStyle = new Style();
    headerStyle.setFont(Font.ARIAL_BIG_BOLD);
    headerStyle.setBorderBottom(Border.PEN_1_POINT());
    headerStyle.setHorizontalAlign(HorizontalAlign.CENTER);
    headerStyle.setVerticalAlign(VerticalAlign.MIDDLE);
    headerStyle.setBackgroundColor(Color.DARK_GRAY);
    headerStyle.setTextColor(Color.WHITE);
    headerStyle.setTransparency(Transparency.OPAQUE);

    Style titleStyle = new Style("titleStyle");
    Style subtitleStyleParent = new Style("subtitleParent");
    subtitleStyleParent.setBackgroundColor(Color.CYAN);
    subtitleStyleParent.setTransparency(Transparency.OPAQUE);

    Style subtitleStyle = Style.createBlankStyle("subtitleStyle", "subtitleParent");
    subtitleStyle.setFont(Font.GEORGIA_SMALL_BOLD);

    AbstractColumn columnNome = ColumnBuilder.getNew().setColumnProperty("nome", String.class.getName())
            .setTitle("Nome").setWidth(200).setStyle(detailStyle).setHeaderStyle(headerStyle).build();

    AbstractColumn columnCpfCnpj = ColumnBuilder.getNew()
            .setColumnProperty(pais.equals(PaisRegiaoEnum.BR) ? "cpfCnpj" : "nif", String.class.getName())
            .setTitle(pais.equals(PaisRegiaoEnum.BR) ? "CPF - CNPJ" : "NIF").setWidth(85).setStyle(valorStyle)
            .setHeaderStyle(headerStyle).build();

    AbstractColumn columnDataInicio = ColumnBuilder.getNew().setColumnProperty("dataInicioReport", String.class.getName())
            .setTitle("Data inicio").setWidth(60).setStyle(valorStyle).setHeaderStyle(headerStyle).build();

    AbstractColumn columnDataFim = ColumnBuilder.getNew().setColumnProperty("dataFimReport", String.class.getName())
            .setTitle("Data fim").setWidth(60).setStyle(valorStyle).setHeaderStyle(headerStyle).build();

    AbstractColumn columnValor = ColumnBuilder.getNew().setColumnProperty("valor", String.class.getName())
            .setTitle("Valor contrato").setWidth(85).setStyle(valorStyle).setHeaderStyle(headerStyle).build();

    AbstractColumn columnEmail = ColumnBuilder.getNew().setColumnProperty("email", String.class.getName())
            .setTitle("E-mail").setWidth(85).setStyle(valorStyle).setHeaderStyle(headerStyle).build();

    AbstractColumn columnContato = ColumnBuilder.getNew().setColumnProperty("numero", String.class.getName())
            .setTitle("Contato").setWidth(85).setStyle(valorStyle).setHeaderStyle(headerStyle).build();

    drb.setDefaultStyles(titleStyle, subtitleStyle, headerStyle, detailStyle);

    drb.addColumn(columnNome);
    drb.addColumn(columnCpfCnpj);
    drb.addColumn(columnDataInicio);
    drb.addColumn(columnDataFim);
    drb.addColumn(columnValor);
    drb.addColumn(columnEmail);
    drb.addColumn(columnContato);

    drb.setMargins(0, 0, 0, 0).setPageSizeAndOrientation(Page.Page_A4_Portrait()).setReportName("AAA")
            .setUseFullPageWidth(true).setIgnorePagination(true);

    return drb.build();`