How to format a cell as accounting.

Aug 13, 2012 at 1:53 PM
Edited Aug 13, 2012 at 1:55 PM

There is a special format option in Excel to format as Accounting. Which uses the localised currency(I need an Euro sign) simbol lines it up on the left, while the currency number is lined up to the right.

Can I use the 

HSSFDataFormat.GetBuiltinFormat()

 to acheive this?

I suppose I will have to create a new custom DataFormat.

IDataFormat accountingFormat = someHSSFWorkbook.CreateDataFormat(); 

But what then?

Aug 14, 2012 at 2:04 PM

Did it customly.

IDataFormat accountingNewFormat = someHssfWorkbook.CreateDataFormat();
accountingDataFormatIndex = accountingNewFormat
                .GetFormat("_ € * #.##0,00_ ,_ € * -#.##0,00_ ,_ € * \" - \"??_ ,_ @_ ");

someHssfCellStyle.DataFormat = accountingDataFormatIndex;

 

The issue I noticed now is that with Calibri 11 font and 

CurrentSheet.SetZoom(7, 10)

The Euro symbol is not visible, when it comes from NPOI, When I zoom it or make the font bigger it becomes visible. Interesting is that when I set it back to 11, The symbol is again visible.