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

How can I export to excel? help me


2004 IR Help

Recommended Posts

By: danielbaltar - danielbaltar

How can I export to excel? help me

2005-11-08 19:47

I can export to pdf em html, but I can´t export to excel, I'm using de following code, please give me any help if you have a tutorial please send me (danielbaltar@yahoo.com.br):

 

 

JasperPrint impressao = JasperFillManager.fillReport(pathJasper

+ "Livros.jasper", parametros, con);

 

//to pdf

// JasperExportManager.exportReportToPdfFile(impressao, path + "/RelatorioLivros.pdf");

// res.sendRedirect("RelatorioLivros.pdf");

 

// to html

JasperExportManager.exportReportToHtmlFile(impressao, path + "/RelatorioLivros.html");

res.sendRedirect("RelatorioLivros.html");

 

 

 

 

 

By: Michael Griffith - mgriffith

RE: How can I export to excel? help me

2005-12-06 12:20

Daniel,

 

Use JRXlsExporter class -- once you've filled the report.

 

JasperPrint print = JasperFillManager(...);

 

JRXlsExporter exporter = new JRXlsExporter();

exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);

 

File destFile = new File(System.currentTimeMillis() + "_xls-export.xls");

destFile.deleteOnExit();

exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());

exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET,

Boolean.TRUE);

 

exporter.exportReport();

 

Once the file has been exported, you can read it and send it via the servlet output stream.

 

HTH,

 

Michael Griffith

 

 

 

 

By: Hamster - larry_hamlet

RE: How can I export to excel? help me

2005-12-06 14:51

Ah yes! But I have run into a different low level problem...

 

I never get past "JRXlsExporter exporter = new JRXlsExporter(); " and throw the following exception:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/hssf/util/HSSFColor$WHITE

at net.sf.jasperreports.engine.export.JRXlsExporter.<init>(JRXlsExporter.java:91)

at CreateJasperReport.createJasperReport(CreateJasperReport.java:80)

 

Do I need to map some other parameter? Works fine from iReport...

 

 

 

 

 

By: hillary - wikkitt

RE: How can I export to excel? help me

2005-12-08 10:51

I am having the same problem...

 

I never get past

JRXlsExporter exporter = new JRXlsExporter();

I don't even get an exception.

 

Any suggestions?

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

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...