Search code examples
javajasper-reportsdynamic-jasper

Rendering Text and Banner in the same header row, DynamicJasper


Is there a way to render Text and ImageBanner in the same Header row?

I tried doing the following:

.addAutoText("kjasdlkf",
            AutoText.POSITION_HEADER, AutoText.ALIGNMENT_LEFT,
            ReportGeneratorConstants.TITLE_CELL_WIDTH, style)
.addFirstPageImageBanner(getPropertyDir() + File.separator
            + REPORTING_FOLDER + File.separator + PDF_EXPORT_FOLDER 
            + File.separator + LOGO_FOLDER_NAME + File.separator 
            + SUFFIX, 197, 60, ImageBanner.Alignment.Left);

But Its rendering the data in multiple lines:

enter image description here

Please suggest!


Solution

  • I have achieved it by overriding CustomLayoutManager class.

    overrided applyImageBannersToBandLocal method to display image logo and custom-text in the same band.

    JRDesignBand headerband = (JRDesignBand) getDesign().getPageHeader();

    applyImageBannersToBand()

       image.setX(xPosition);
       image.setY(0);