You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by TK <ta...@hotmail.com> on 2009/10/08 18:22:06 UTC
autoSizeColumn with Format
Hello,
I seem to have a problem with using autoSizeColumn function with monetize
columns which use format. I'm using 3.5 with the following sample code:
HSSFWorkbook wb = new HSSFWorkbook();
HSSFCellStyle money_format = wb.createCellStyle();
money_format.setDataFormat(wb.createDataFormat().getFormat("_($* #,##0.00_);_($*
(#,##0.00);_($* \"-\"??_);_(@_)"));
HSSFSheet sheet = wb.createSheet("test");
HSSFRow row = sheet.createRow(0);
HSSFCell xcell = row.createCell(0);
xcell.setCellValue(51123.41);
xcell.setCellStyle(money_format);
sheet.autoSizeColumn((short)0);
The field format ends up at what looks like the size of '51123.41' instead of
'$51,123.41'....
Am I doing something wrong?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org