Jump to content
We've recently updated our Privacy Statement, available here ×

Exception with XLS


bcaramu

Recommended Posts

Hi All

Please tell me what is problem in my code

I need the solution . Please in this Problem


Code:
Exception:Exception in thread "main" java.lang.ClassCastException: net.sf.jasperreports.engine.JasperReport cannot be cast to net.sf.jasperreports.engine.JasperPrint	at net.sf.jasperreports.engine.JRAbstractExporter.setInput(JRAbstractExporter.java:640)	at net.sf.jasperreports.engine.export.JRXlsAbstractExporter.exportReport(JRXlsAbstractExporter.java:179)	at com.cmc.report.launch.ReportController.main(ReportController.java:108)Source:			File sourceFile = (new ClassPathResource(jdbcSampleReportJasperFile))					.getFile();			System.out.println(sourceFile.canRead());			JasperReport jasperPrint = (JasperReport) JRLoader					.loadObject(sourceFile);			File destFile = new File(sourceFile.getParent(), jasperPrint					.getName()					+ EXTENSION_XLS);			JRXlsExporter exporter = new JRXlsExporter();			exporter					.setParameter(JRExporterParameter.JASPER_PRINT, report);			exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME,					destFile.toString());			exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET,Boolean.FALSE);			exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND,Boolean.FALSE);			exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,Boolean.TRUE);			exporter.exportReport();
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...