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


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"/>

It is expected that we can set


or as a property in JRXML

<property name="net.sf.jasperreports.export.xls.create.custom.palette" value="true"/>
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.NullPointerException
at net.sf.jasperreports.engine.export.JRXlsExporter.getWorkbookColor(

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 ( ) so the question is if anybody has managed to use custom colors from the jasperreports library and how.

Thanks in advance,

- Nestor

nestoru's picture
Joined: Jun 9 2011 - 7:11am
Last seen: 6 years 7 months ago

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 );



jt.shyman - 6 years 6 months ago

0 Answers:

No answers yet