Hi all,

I just want to generate a password protected excel report using JasperReports.

I have no problem in generating an excel report using the following lines of code :

try {
JRCsvDataSource jrCsvDS = new JRCsvDataSource(JRLoader.getLocationInputStream(sLocation + "/" + "BADC" + sFName + ".csv"));

JasperReport jrReport = (JasperReport) JRLoader.loadObject(CommonRoutines.getDirectory() + "/ABSTRACT.jasper"); //load jasper file (compiled report layout)
JasperFillManager.fillReportToFile(jrReport, CommonRoutines.getDirectory() + "/ABSTRACT.jrprint", jrParams, jrCsvDS); //fill report

//Export report to .xls file
JRXlsExporter xlsExporter = new JRXlsExporter();
xlsExporter.setParameter(JRExporterParameter.JASPER_PRINT, (JasperPrint)JRLoader.loadObject(CommonRoutines.getDirectory() + "/ABSTRACT.jrprint"));
xlsExporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, sXlsFileName);
xlsExporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE);
//xlsExporter.setParameter(JRXlsExporterParameter.PASSWORD, "test");

catch (JRException e) {
String sErrorMessage = e.toString();

But I need the generated excel file to be password protected and that I don't know how.
Please do help me. I know there's just something missing here because the code above is successful and it works just fine. That's why I wanted to keep it, I just need help on the "password protecting" part.

Please, please, please.
Thanks a lot!!