Jump to content
Changes to the Jaspersoft community edition download ×

How can I set a custom palette? Getting net.sf.jasperreports.export.xls.create.custom.palette=true causes NullPointerException at net.sf.jasperreports.engine.export.JR


nestoru

Recommended Posts

Hello,

We cannot make custom palette to work. 

From iReport Designer version 5.6.0 we can set a custom backcolor which will correctly export the excel cell with expected backgroiund color:

<reportElement mode="Opaque" x="0" y="26" width="250" height="26" forecolor="#FFFFFF" backcolor="#5D87A1" uuid="67e64e41-d7ac-4a1a-aba1-d44eb862c564"/>[/code]

It is expected that we can set jasperreports.properties:

net.sf.jasperreports.export.xls.create.custom.palette=true[/code]

or as a property in JRXML 

<property name="net.sf.jasperreports.export.xls.create.custom.palette" value="true"/>[/code]
To get the exact color from a jasperreports exporter however  after using the jrxml from jasperreports 5.6.0 jar it will not respect the custom color and instead break with a NullPointerException:
Caused by: java.lang.NullPointerExceptionat net.sf.jasperreports.engine.export.JRXlsExporter.getWorkbookColor(JRXlsExporter.java[/code]

Going back to version 4.7.1 it will not break but it will not change the color either. Moving forward to jasperreports version 6.0.0 will also result in NullPointerException.

Apparently this works correctly for Jasper Server ( https://community.jaspersoft.com/wiki/discrepancy-report-xls-output-cell-background-color-using-jasperreports-server-web-services ) so the question is if anybody has managed to use custom colors from the jasperreports library and how.

Thanks in advance,

- Nestor

 

 

Link to comment
Share on other sites

  • 1 year later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

We were having the same issue with JRS 5.6.1. We discovered that the exporter seems to be ignoring the property in the jrxml.

To resolve this, we added the highlighted line to the Java code we are using to export the report:

 

JRXlsExporter jRXlsExporter = new JRXlsExporter();
SimpleXlsExporterConfiguration ec = new SimpleXlsExporterConfiguration();
ec.setCreateCustomPalette( Boolean.TRUE );
jRXlsExporter.setConfiguration(ec);
jRXlsExporter.exportReport();    

 

 

Link to comment
Share on other sites

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