This sample code does not produce the expected result (value is present in the cell but not visible). import java.io.*; import org.apache.poi.hssf.usermodel.*; public class Test { public Test() { } public static void main(String[] args) { try { FileOutputStream out = new FileOutputStream("test.xls"); HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet("Test"); HSSFRow row = sheet.createRow(0); HSSFCell cell = row.createCell((short)0); HSSFDataFormat fmt = workbook.createDataFormat(); HSSFCellStyle style = workbook.createCellStyle(); style.setDataFormat(fmt.getFormat("$#,##0")); cell.setCellStyle(style); cell.setCellValue(1234.56); workbook.write(out); out.close(); } catch (Throwable t) { t.printStackTrace(); } } }
What exact version are you using? If it is a nightly release, what is the date you got it? I tested it against the current version and everything checks out. There was a bug that was fixed about a week or so ago that would give these results.
I am using the 1.8.0-dev-bin release. Just downloaded it today, in fact.
That's the problem. This is a duplicate of http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13248 and has been fixed in the current nightly builds. *** This bug has been marked as a duplicate of 13248 ***