Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Jasper report issue report row <65535 but can't generated correctly

807588Apr 24 2009 — edited Jun 18 2009
Hi All ,
We are trying to create report with jasper report . The issue is sometime generated report can be open.

Below is test case and result .

1. when dummy all the returned field of procedure to ‘1’ and 20000 rows are to printed in report. The file size is 7564K. The excel can be open after several minutes waiting.

2. When dummy the procedure only return 5000 rows with actual data, the field type may be char, number. The file size is 2010K. The excel can be open quickly.

3. When dummy the procedure only return10000 rows with actual data. The file size is 3999K. The excel cannot be open.

What the issue may be?
Below is our code.



/**
* Generate the the report, currently generate excel report.
* @param results - data set return from procedure execution
* @param parameters - input parameters for Jasper Report design
* @param procName - Jasper file name
* @param outputFile - used as report file name
* @throws JRException - Jasper exception
*/
private void ReportGenerator(List<ScriptParameterObject> results,HashMap<String, Object> parameters, String procName,String outputFile) throws JRException, Exception
{
logger.info("Creating report: " + outputFile + ".xls");
//URL en = ClassLoader.getSystemResource("jasper"+java.io.File.separator+procName + ".jasper");
URL en = ClassLoader.getSystemResource(procName + ".jasper");
if(en==null)
throw new Exception("Can't find jasper file: " + procName + ".jasper");
logger.debug("Loading jasper file: " + en.getPath());
//InputStream isJasper = ClassLoader.getSystemResourceAsStream("jasper"+java.io.File.separator+procName + ".jasper");
InputStream isJasper = ClassLoader.getSystemResourceAsStream(procName + ".jasper");

JasperReport relatorio = (JasperReport) JRLoader.loadObject(isJasper);
SapiData sapiData = new SapiData(results);
logger.debug("Filling report file ..." + results.size());
JasperPrint impressao=null;
try{
impressao = JasperFillManager.fillReport(relatorio,parameters, sapiData);
}
catch(Exception ex){
System.out.println(ex); ---never catch error. but not know why the .xls can't open
}
if (impressao == null) {

logger.debug("impressao == nul.");
}
logger.debug("Filled report file successfully.");
impressao.setLocaleCode(Locale.getDefault().getCountry());

JRAbstractExporter saida = null;
saida = new JRXlsExporter();
saida.setParameter(JRExporterParameter.JASPER_PRINT, impressao);
saida.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, outputFile + ".xls");
saida.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET,Boolean.FALSE);
saida.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND,Boolean.TRUE);
saida.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,Boolean.TRUE);
saida.setParameter(JRXlsExporterParameter.IS_COLLAPSE_ROW_SPAN,Boolean.TRUE);
saida.setParameter(JRXlsExporterParameter.MAXIMUM_ROWS_PER_SHEET, Integer.decode("5000"));

logger.debug("Exporting excel report file ...");
saida.exportReport();
logger.debug("Generated excel report file successfully: "+outputFile + ".xls");

/* - used for generate html report
JRAbstractExporter htmlExp = new JRHtmlExporter();
htmlExp.setParameter(JRExporterParameter.JASPER_PRINT, impressao);
htmlExp.setParameter(JRHtmlExporterParameter.OUTPUT_FILE_NAME,outputFile + ".html");
htmlExp.setParameter(JRHtmlExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,Boolean.TRUE);
htmlExp.setParameter(JRHtmlExporterParameter.IS_WRAP_BREAK_WORD,Boolean.TRUE);
htmlExp.exportReport();
*/
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 16 2009
Added on Apr 24 2009
1 comment
213 views