byte odtByte[] = (byte[])null;
ByteArrayOutputStream byArrOutputStr = null;
try
{
//pdfByte = JasperExportManager.exportReportToPdf(jasperprint);
byArrOutputStr = new ByteArrayOutputStream();
JROdtExporter exporter = new JROdtExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT_LIST,list);
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, byArrOutputStr);
exporter.exportReport();
odtByte = byArrOutputStr.toByteArray();
} catch(JRException e) {
logger.error("Error in creating ODT file : "+e);
} catch(Exception e) {
logger.error("Error in creating ODT file : "+e);
} finally {
//to close resource
try {
byArrOutputStr.close();
} catch (IOException e) {
// Ignored;
}
}
ByteArrayOutputStream byArrOutputStr = null;
try
{
//pdfByte = JasperExportManager.exportReportToPdf(jasperprint);
byArrOutputStr = new ByteArrayOutputStream();
JROdtExporter exporter = new JROdtExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT_LIST,list);
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, byArrOutputStr);
exporter.exportReport();
odtByte = byArrOutputStr.toByteArray();
} catch(JRException e) {
logger.error("Error in creating ODT file : "+e);
} catch(Exception e) {
logger.error("Error in creating ODT file : "+e);
} finally {
//to close resource
try {
byArrOutputStr.close();
} catch (IOException e) {
// Ignored;
}
}
No comments:
Post a Comment