JasperReports allows you to use any color for your report elements.
However, when exporting to XLS format, you have to be aware that this type of files supports only a limited set of colors.
Here is the Standard Excel Color Palette containing all the 40 colors that XLS may use. Make sure you use one of these colors if you want to eventually export your reports to XLS format.
#FFFF00
|
YELLOW | #003300
|
DARK_GREEN | |||
#969696
|
GREY_40_PERCENT | #808000
|
DARK_YELLOW | |||
#99CC00
|
LIME | #FF00FF
|
PINK | |||
#CC99FF
|
LAVENDER | #FF99CC
|
ROSE | |||
#FFFF99
|
LIGHT_YELLOW | #3366FF
|
LIGHT_BLUE | |||
#008000
|
GREEN | #FF6600
|
ORANGE | |||
#C0C0C0
|
GREY_25_PERCENT | #993300
|
BROWN | |||
#339966
|
SEA_GREEN | #993366
|
PLUM | |||
#FF9900
|
LIGHT_ORANGE | #800080
|
VIOLET | |||
#FF0000
|
RED | #333399
|
INDIGO | |||
#003366
|
DARK_TEAL | #000000
|
BLACK | |||
#FFFFFF
|
WHITE | #00CCFF
|
SKY_BLUE | |||
#99CCFF
|
PALE_BLUE | #333333
|
GREY_80_PERCENT | |||
#00FFFF
|
TURQUOISE | #CCFFFF
|
LIGHT_TURQUOISE | |||
#008080
|
TEAL | #CCFFCC
|
LIGHT_GREEN | |||
#000080
|
DARK_BLUE | #666699
|
BLUE_GREY | |||
#FFCC00
|
GOLD | #0000FF
|
BLUE | |||
#33CCCC
|
AQUA | #00FF00
|
BRIGHT_GREEN | |||
#333300
|
OLIVE_GREEN | #800000
|
DARK_RED | |||
#808080
|
GREY_50_PERCENT | #FFCC99
|
TAN |
If the colors you use in your report designs do not match any of these acceptable colors, the XLS exporter will use a special algorithm to determine which is the nearest one by comparing the RGB levels. But the results might not be always what you expect.
JasperReports supplies a way to avoid this, enlarging the number of possible color choices. If the export is performed using the JExcelApiExporter class, one have to consider the JExcelApiExporterParameter.CREATE_CUSTOM_PALETTE export parameter. It is a flag specifying whether the standard color palette should be customized so that the XLS result uses the original report colors.
If this flag is not set, the nearest color from the standard XLS palette is chosen for a report color.
If the flag is set, the nearest not yet modified color from the palette is chosen and modified to exactly match the report color. If all the colors from the palette are modified (the palette still has a fixed size), the nearest color from the palette is chosen for further report colors.
Log in or register to post comments