Tag Archives: JasperReport

XLS Colors for JasperReports

One of the things that I often end up Googling is a list of the 56 default XLS colors. I finally decided to compile my own list so that I can simply copy and paste the value that I need to use for either the Forecolor or Backcolor in the properties pane:

Name Jasper Value Hex Code R G B
Black [0,0,0] #000000 0 0 0
White [255,255,255] #FFFFFF 255 255 255
Red [255,0,0] #FF0000 255 0 0
Green [0,255,0] #00FF00 0 255 0
Blue [0,0,255] #0000FF 0 0 255
Yellow [255,255,0] #FFFF00 255 255 0
Magenta [255,0,255] #FF00FF 255 0 255
Cyan [0,255,255] #00FFFF 0 255 255
[Color 9] [128,0,0] #800000 128 0 0
[Color 10] [0,128,0] #008000 0 128 0
[Color 11] [0,0,128] #000080 0 0 128
[Color 12] [128,128,0] #808000 128 128 0
[Color 13] [128,0,128] #800080 128 0 128
[Color 14] [0,128,128] #008080 0 128 128
[Color 15] [192,192,192] #C0C0C0 192 192 192
[Color 16] [128,128,128] #808080 128 128 128
[Color 17] [153,153,255] #9999FF 153 153 255
[Color 18] [153,51,102] #993366 153 51 102
[Color 19] [255,255,204] #FFFFCC 255 255 204
[Color 20] [204,255,255] #CCFFFF 204 255 255
[Color 21] [102,0,102] #660066 102 0 102
[Color 22] [255,128,128] #FF8080 255 128 128
[Color 23] [0,102,204] #0066CC 0 102 204
[Color 24] [204,204,255] #CCCCFF 204 204 255
[Color 25] [0,0,128] #000080 0 0 128
[Color 26] [255,0,255] #FF00FF 255 0 255
[Color 27] [255,255,0] #FFFF00 255 255 0
[Color 28] [0,255,255] #00FFFF 0 255 255
[Color 29] [128,0,128] #800080 128 0 128
[Color 30] [128,0,0] #800000 128 0 0
[Color 31] [0,128,128] #008080 0 128 128
[Color 32] [0,0,255] #0000FF 0 0 255
[Color 33] [0,204,255] #00CCFF 0 204 255
[Color 34] [204,255,255] #CCFFFF 204 255 255
[Color 35] [204,255,204] #CCFFCC 204 255 204
[Color 36] [255,255,153] #FFFF99 255 255 153
[Color 37] [153,204,255] #99CCFF 153 204 255
[Color 38] [255,153,204] #FF99CC 255 153 204
[Color 39] [204,153,255] #CC99FF 204 153 255
[Color 40] [255,204,153] #FFCC99 255 204 153
[Color 41] [51,102,255] #3366FF 51 102 255
[Color 42] [51,204,204] #33CCCC 51 204 204
[Color 43] [153,204,0] #99CC00 153 204 0
[Color 44] [255,204,0] #FFCC00 255 204 0
[Color 45] [255,153,0] #FF9900 255 153 0
[Color 46] [255,102,0] #FF6600 255 102 0
[Color 47] [102,102,153] #666699 102 102 153
[Color 48] [150,150,150] #969696 150 150 150
[Color 49] [0,51,102] #003366 0 51 102
[Color 50] [51,153,102] #339966 51 153 102
[Color 51] [0,51,0] #003300 0 51 0
[Color 52] [51,51,0] #333300 51 51 0
[Color 53] [153,51,0] #993300 153 51 0
[Color 54] [153,51,102] #993366 153 51 102
[Color 55] [51,51,153] #333399 51 51 153
[Color 56] [51,51,51] #333333 51 51 51

JasperReport Excel Options

Over the past year I have been learning about so many different OpenSource packages it isn’t even funny.  One thing that is available for free, but also has a paid version (which we at using at UniTek Global Services), is JasperServer.  Right now we are on version 4.2.1.  When we first rolled it out, everything seemed to work excellently with the exception of three things:

  1. In the report template, I placed the company logo to the left of two rows:  the report title and the description/generation date.  Whenever I generated the report as an XLS via Jaspersoft iReport Designer, the image would load correctly.  On the other hand, whenever I generated the report as an XLS via the JasperServer, the space for the image was left there without an image.
  2. Once the image issue was resolved (I will describe how soon), the XLS generated via the JasperServer would load the image on the same row as the title but it wouldn’t extend into the cell directly below so that it would appear to the left of the description as well.
  3. XLS reports generated via the JasperServer were not showing borders on any of the cells no matter how large I made the borders in the designer.

If you encounter these issues in your JasperReport template, do the following:

  1. In the Report Inspector pane, click on the top-most element (which is the template).
  2. In the Properties pan, select the Properties row and then select the elipsis at the right of the row.
  3. Show Images In XLS:
    To ensure that images will appear when exported as XLS, do the following:
    1. Click the Add button in the Properties window.
    2. Enter the following as the Property name:
      net.sf.jasperreports.export.xls.ignore.graphics
    3. Enter the following as the Property value:
      false
    4. Click OK to close the Add/modify property window.
  4. Allow Cells To Span Multiple Rows In XLS:
    To ensure that cells can span multiple rows when exported as XLS, do the following:
    1. Click the Add button in the Properties window.
    2. Enter the following as the Property name:
      net.sf.jasperreports.export.xls.collapse.row.span
    3. Enter the following as the Property value:
      false
    4. Click OK to close the Add/modify property window.
  5. Show Borders In XLS:
    To ensure that images will appear when exported as XLS, do the following:
    1. Click the Add button in the Properties window.
    2. Enter the following as the Property name:
      net.sf.jasperreports.export.xls.ignore.cell.border
    3. Enter the following as the Property value:
      false
    4. Click OK to close the Add/modify property window.