I am creating a spreadsheet from database input. I apply a formula to
calculate totals for currency cells and apply a currency style but when it
opens in excel the style is just general number. Here is  the basic code:
                row = sheet.createRow(rownum);
                HSSFCell ccell = row.createCell(0);
                HSSFFont headerFont = new_workbook.createFont();
                headerFont.setBoldweight((short) 128);
                headerFont.setFontName("Arial");
                cStyle = new_workbook.createCellStyle();
                cStyle.setWrapText(false);
                cStyle.setDataFormat((short) 8); //Currency Format with parens 
and red for
negative
        cStyle.setFont(headerFont);
        ccell.setCellStyle(cStyle);
                ccell.setCellType(HSSFCell.CELL_TYPE_FORMULA);
                String formula = "SUM(A1:A" + (rownum - 1)+")";
                ccell.setCellFormula(formula);

The formula calculates the correct total but no style. Ironically it opens
correctly in Apple Numbers.
   Thanks for any inputs on this.
   Scott




--
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/HSSF-CELL-TYPE-FORMULA-cells-ignoring-applied-style-tp5719885.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to