My Jasper Template shows no text

前端 未结 1 336
清歌不尽
清歌不尽 2020-11-29 13:58

I am currently unsure why if I ran this sample template of mine, I cannot see any text.




        
相关标签:
1条回答
  • 2020-11-29 14:34

    You did not specify the datasource and so the cause of your report is empty.

    You can set whenNoDataType (When No Data property in iReport) report's attribute for showing "empty" report.

    The possible values of this attribute are:

    • No Pages: The generated document will have no pages in it. Viewers might throw an error when trying to load such documents (whenNoDataType="NoPages").
    • Blank Page: The generated document will contain a single blank page (whenNoDataType="BlankPage").
    • All Sections, No Detail: All the report sections except the Detail section (band) will appear in the generated document (whenNoDataType="AllSectionsNoDetail").
    • No Data Section: The generated document will contain only a single noData section (band) (whenNoDataType="NoDataSection").

    In case using noData section you should add this band to the report's template (for example, with help of iReport).


    When you are using the Java code like this:

    JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,
           map, new JREmptyDataSource());
    

    it means that you are passing the empty datasource or in other words did not pass the datasource.

    In case you did not pass datasource and database connection the only chance to show the data at report - is to pass data via parameters (or initialize parameters inside the report's template)

    0 讨论(0)
提交回复
热议问题