public DynamicReport buildReport() throws Exception {

    DynamicReportBuilder drb = new DynamicReportBuilder();
    Integer margin = new Integer(20);
    drb.setTitle("November" + getYear() + " sales report") // defines the title of the report
        .setSubtitle(
            "The items in this report correspond "
                + "to the main products: DVDs, Books, Foods and Magazines")
        .setTitleHeight(new Integer(30))
        .setSubtitleHeight(new Integer(20))
        .setDetailHeight(new Integer(15))
        .setLeftMargin(margin)
        .setRightMargin(margin)
        .setTopMargin(margin)
        .setBottomMargin(margin)
        .setColumnsPerPage(new Integer(1))
        .setColumnSpace(new Integer(5));

    Style style1 = new Style("style1");
    style1.setFont(Font.ARIAL_MEDIUM_BOLD);
    style1.setHorizontalAlign(HorizontalAlign.CENTER);
    drb.addStyle(style1);

    Style style2 = Style.createBlankStyle("style2", "style1");
    style2.setTextColor(Color.BLUE);
    drb.addStyle(style2);

    AbstractColumn columnState =
        ColumnBuilder.getNew()
            .setColumnProperty("state", String.class.getName())
            .setTitle("State")
            .setWidth(new Integer(85))
            .setStyle(style1)
            .build();

    AbstractColumn columnBranch =
        ColumnBuilder.getNew()
            .setColumnProperty("branch", String.class.getName())
            .setTitle("Branch")
            .setWidth(new Integer(85))
            .setStyle(style2)
            .build();

    drb.addColumn(columnBranch);
    drb.addColumn(columnState);

    DJGroup g1 =
        new GroupBuilder()
            .setCriteriaColumn((PropertyColumn) columnBranch)

            //		.setGroupLayout(GroupLayout.DEFAULT)
            .setGroupLayout(GroupLayout.DEFAULT_WITH_HEADER)
            .build();
    drb.addGroup(g1);

    drb.setUseFullPageWidth(true);

    DynamicReport dr = drb.build();
    return dr;
  }
  @SuppressWarnings({"rawtypes", "unchecked"})
  private static DynamicReport criaRelatorioDinamico(
      List<? extends Entidade> lista, String caminhoImagem) {
    DynamicReportBuilder relatorioBuilder = new DynamicReportBuilder();

    Class<Entidade> classeEntidadeRelatorio = (Class<Entidade>) lista.get(0).getClass();
    Relatorio relatorioAnnotation = classeEntidadeRelatorio.getAnnotation(Relatorio.class);

    if (relatorioAnnotation != null) {
      relatorioBuilder.setPageSizeAndOrientation(relatorioAnnotation.orientacao().getPage());
      relatorioBuilder.addFirstPageImageBanner(
          caminhoImagem, new Integer(197), new Integer(60), ImageBanner.ALIGN_LEFT);
      relatorioBuilder.setReportName(obtemNomeArquivo(relatorioAnnotation));
      relatorioBuilder.setTitle(obtemTitulo(relatorioAnnotation));
      relatorioBuilder.setOddRowBackgroundStyle(obtemEstiloLinhaPar());
      relatorioBuilder.setPrintBackgroundOnOddRows(true);
      relatorioBuilder.setUseFullPageWidth(true);
      relatorioBuilder.setDefaultStyles(
          getEstiloTitulo(), geraEstiloSubTitulo(), geraEstiloCabecalho(), geraEstiloDetalhe());
      relatorioBuilder.addStyle(adicionaEstiloSubTitulo());
      relatorioBuilder = geraColunasRelatorio(relatorioBuilder, classeEntidadeRelatorio);
    } else {
      relatorioBuilder = new ReflectiveReportBuilder(lista);
    }

    return relatorioBuilder.build();
  }
  public DynamicReport buildReport() throws Exception {
    Style detailStyle = new Style();
    Style headerStyle = new Style();

    Border border = Border.THIN();
    border.setColor(Color.LIGHT_GRAY);
    border.setLineStyle(Border.BORDER_STYLE_DOTTED);

    Font titleFont = Font.ARIAL_BIG_BOLD;
    titleFont.setFontSize(34);

    headerStyle.setBackgroundColor(new Color(230, 230, 230));
    headerStyle.setBorderBottom(Border.THIN());
    headerStyle.setHorizontalAlign(HorizontalAlign.LEFT);
    headerStyle.setVerticalAlign(VerticalAlign.MIDDLE);
    headerStyle.setTransparency(Transparency.OPAQUE);

    detailStyle.setBorderLeft(border);
    detailStyle.setBorderRight(border);

    Style titleStyle = new Style();
    titleStyle.setHorizontalAlign(HorizontalAlign.LEFT);
    titleStyle.setFont(titleFont);
    titleStyle.setTextColor(Color.white);

    Style subtitleStyle = new Style();
    subtitleStyle.setHorizontalAlign(HorizontalAlign.RIGHT);
    subtitleStyle.setTextColor(Color.white);

    /** Creates the DynamicReportBuilder and sets the basic options for the report */
    DynamicReportBuilder drb = new DynamicReportBuilder();
    drb.setTitle(mTitle) // defines the title of the report
        .setSubtitle("generiert mit ArtiVer")
        .setDetailHeight(15) // defines the height for each record of the report
        .setMargins(
            30, 20, 30, 15) // define the margin space for each side (top, bottom, left and right)
        .setDefaultStyles(titleStyle, subtitleStyle, headerStyle, detailStyle)
        .setColumnsPerPage(1); // defines columns per page (like in the telephone guide)

    addColumns(drb, mCols);

    /** add some more options to the report (through the builder) */
    drb.setUseFullPageWidth(true);

    // This look for the resource in the classpath
    File ralPath =
        new File("/eu/gymnaila/chunks/artiver/reports" + "/" + mReportTemplate + ".jrxml");

    if (!ralPath.exists()) {
      ralPath = new File("dist/data/reports/" + mReportTemplate + ".jrxml");
    }
    System.out.println(ralPath.getPath());

    drb.setTemplateFile(ralPath.getPath());

    DynamicReport dr = drb.build();

    return dr;
  }