=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/ExcelUtils.java' --- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/ExcelUtils.java 2009-11-16 04:56:59 +0000 +++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/ExcelUtils.java 2009-11-17 05:07:58 +0000 @@ -40,6 +40,7 @@ import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFCellStyle; +import org.apache.poi.hssf.usermodel.HSSFErrorConstants; import org.apache.poi.hssf.usermodel.HSSFRichTextString; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; @@ -145,7 +146,18 @@ } else if ( type.equalsIgnoreCase( ExcelUtils.NUMBER ) ) { - cellPOI.setCellValue( Double.parseDouble( value ) ); + if ( Double.isNaN( Double.valueOf( value ) ) ) + { + cellPOI.setCellErrorValue( (byte) HSSFErrorConstants.ERROR_NA ); + } + else if ( Double.isInfinite( Double.valueOf( value ) ) ) + { + cellPOI.setCellErrorValue( (byte) HSSFErrorConstants.ERROR_NUM ); + } + else + { + cellPOI.setCellValue( Double.parseDouble( value ) ); + } } } }