Progress while filling jasper report

后端 未结 3 1734
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-02 11:21

I would like to give progress to the user while Jasper reports is filling a compile report. Basically I would like to get progress while this is executing:

JasperFi

相关标签:
3条回答
  • 2021-01-02 11:40

    I'm using this components from PrimeFaces to show that the report is generating:

    <p:ajaxStatus onstart="dlg.show();" onsuccess="dlg.hide();" />
            <p:dialog modal="true"  header="Creating Report" widgetVar="dlg" draggable="false" closable="false" >
                <p:graphicImage value="/resources/images/ajaxloadingbar.gif" />
            </p:dialog>
    

    I don't have any real way to determine the total time my reports will take to compile and fill, so I opted not to use an actual progress bar which sometimes fills before the report is complete.

    0 讨论(0)
  • 2021-01-02 11:50

    From Jasper Reports version 4.6.0 You can use FillListener:

    AsynchronousFillHandle handle = AsynchronousFillHandle.createHandle(jasperReport, params, dataSource);
    handle.addFillListener(new FillListener() {
    
        @Override
        public void pageUpdated(JasperPrint jasperPrint, int pageIndex) {
            log.info("pageUpdated " + pageIndex);
        }
    
        @Override
        public void pageGenerated(JasperPrint jasperPrint, int pageIndex) {
            log.info("pageGenerated " + pageIndex);
        }
    });
    

    NOTE: to build 4.6.0 version get sources from svn and use ant:

    svn co http://jasperforge.org/svn/repos/jasperreports (user/pass: anonymous)
    cd jasperreports\trunk\jasperreports
    ant jar
    
    0 讨论(0)
  • 2021-01-02 11:51

    I'm afraid it's not possible to monitor progress of filling jasper report (as of version 4.0.2)- net.sf.jasperreports.engine.fill.JRFiller doesn't offer any kind of progress notification.

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