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:
JasperFillManager.fillReport(JasperReport rpt, Map params, JRDataSource src)
Is there anyway to achieve this?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With