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

Problem setting cell colors in Excel export


jstoneburner

Recommended Posts

I'm having a problem when it comes to setting the backgroud color of my report when it is exported to Excel.  Our organizatin is still using JasperReports version 3.0 for the time being.

The report itself is filled correctly and displays the correct information minus any colors I added.  I've tried to use both the backcolor property of the report elements for the individual fields as well as adding a colored rectangle. behind the fields.  This approach works fine if I export the report to PDF format.  I am using the colors #C0C0C0 and #969696 which I found as being Excel "safe."

The code I'm using to generate the Excel file itself is as follows:

JRXlsExporter exporterXLS = new JRXlsExporter();               
exporterXLS.setParameter(JRXlsExporterParameter.JASPER_PRINT, jasperPrint);
exporterXLS.setParameter(JRXlsExporterParameter.OUTPUT_FILE_NAME, filePath);
exporterXLS.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, true);
exporterXLS.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS, true);
exporterXLS.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, true);
exporterXLS.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, false);                              
exporterXLS.exportReport(); 

As I said, the report is filled correctly, but is just missing the colors.  Is there any advice on how to solve this?

Link to comment
Share on other sites

  • Replies 2
  • 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...