vintila_2005 Posted February 9, 2015 Posted February 9, 2015 I use JRXlsExporter to write my .xls files it works ok as long as I write in a new file every time, my problem is that i want to append an existing .xls file and add new data to the end of that file.public static void exportXLS(JasperPrint jasperPrint, String fileName) throws IOException, JRException{ SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration(); configuration.setOnePagePerSheet(true); configuration.setDetectCellType(true); configuration.setCollapseRowSpan(false); configuration.setWhitePageBackground(false); File file = new File(fileName+".xls"); FileOutputStream fos = new FileOutputStream(file,true); JRXlsExporter exporterXLS = new JRXlsExporter(); exporterXLS.setExporterInput(new SimpleExporterInput(jasperPrint)); exporterXLS.setExporterOutput(new SimpleOutputStreamExporterOutput(fos)); exporterXLS.setConfiguration(configuration); exporterXLS.exportReport(); fos.flush(); fos.close() } [/code]
marianol Posted February 10, 2015 Posted February 10, 2015 Check this Sample, is comes with JR so you should have it under /demo/samples/xlsfeatures/http://jasperreports.sourceforge.net/sample.reference/xlsfeatures/#xlsfeaturesYou need to use the net.sf.jasperreports.export.xls.workbook.template property See the section "Embedding Content From External Documents Into The Generated Document "
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now