Wednesday, February 15, 2012

Jasper export to Excel Integer Cell is blank

Excel was rendering a blank column that otherwise iReport was showing correctly with numbers.

An inspection of "Format Cells" option would show two semicolons ";;" which means "do not show". A click on the cell was revealing the values though.

In this case I solved the issue setting the pattern attribute of the textField node like below. Note that the code generates an auto-increment number BTW:

<textField pattern="###0;-###0" isBlankWhenNull="false">
  <reportElement mode="Transparent" x="0" y="0" width="34" height="13" forecolor="#000000" backcolor="#FFFFFF"/>
  <textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none">
  <font fontName="DejaVu Sans" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
  <paragraph lineSpacing="Single"/>

No comments: