Jump to content
Changes to the Jaspersoft community edition download ×

Multiple sheets in single Excel file


geniusgroup

Recommended Posts

Hi, I am new in using JasperReports. Its a great tool and I would like to use it to generate MS Excel reports. Now I have some questions. Is it possible to create multiple sheets (insert tabs) in single Excel file. What should I do in the jrxml file?

 

Thank you:cheer:

 

From Wilson

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

I made the same question longtime ago and nobody told me anything...so i just did:

 

1. i made a different report for every sheet i want in my final file.

2. fill independently every report

3. Remove every page of every report and then i add them to one report

4. Export this only report to xls and thats all...

 

this is an example:

Steps 1 and 2:

JasperPrint jp_CPU = JasperFillManager.fillReport(ruta + cpu, parameters, con);

JasperPrint jp_RED = JasperFillManager.fillReport(ruta + red, parameters, con);

 

Steps 3:

for (int cont = 0; cont < pag_red; cont++) {

jp_CPU.addPage(i, (JRPrintPage)l.get(cont));

i = i + 1;

}

 

Step 4:

JRXlsExporter exporter = new JRXlsExporter();

exporter.setParameter(JRXlsExporterParameter.

IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);

exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET,

Boolean.TRUE);

exporter.setParameter(JRExporterParameter.JASPER_PRINT, jp_CPU);

exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME,

destFile.toString());

exporter.exportReport();

 

 

i don't know if there are a better way to do this...but it works to me... i hope it helps u ;)

 

Viviana

Link to comment
Share on other sites

  • 10 months later...

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