Mukhamedali  Zhadigerov
Mukhamedali Zhadigerov

Reputation: 861

Apache POI: Excel changes my format string

I have this code:

 HSSFCellStyle styleCurrency = workbook.createCellStyle();;
 CreationHelper ch = workbook.getCreationHelper();
 String format="# #";
 DataFormat dataFormat=ch.createDataFormat();
 styleCurrency.setDataFormat(dataFormat.getFormat(format));

But when i check that cell in Excel's Format Dialogue it shows : #\# (It adds slash). Why?

I'm using Excel 2003.

Upvotes: 1

Views: 628

Answers (1)

Mukhamedali  Zhadigerov
Mukhamedali Zhadigerov

Reputation: 861

I found the ansewer by myself (as usual no help). To dysplay # # in Excel's Format Dialogue, add comma between #'s instead of white space. So #,# becames # #. Also, 0,00 becames 000 in Format Dialogue. To fix it add dot instead of comma, so 0.00 = 0,00. Interesting why noone faced the same problem before as there's no info in internet.

Upvotes: 3

Related Questions