Jump to content
JasperReports 7.0 is now available ×

How to append and write a .xls file with JRXlsExporter


Recommended Posts

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]
Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...