You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2009/06/05 02:44:35 UTC

DO NOT REPLY [Bug 47282] The data format string is incorrect for Accounting style

https://issues.apache.org/bugzilla/show_bug.cgi?id=47282


Josh Micich <jo...@gildedtree.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO




--- Comment #1 from Josh Micich <jo...@gildedtree.com>  2009-06-04 17:44:33 PST ---
There clearly is a difference as you have pointed out.

Excel displays:
_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)

new HSSFWorkbook().createDataFormat().getFormat((short)0x2c);
returns:
_($*#,##0.00_);_($*(#,##0.00);_($*"-"??_);_(@_)


However, it is not clear how this causes a problem.  My understanding was that
the 'built-in' formats are referenced by their index (in this case 0x2c) and
not by their textual representation.

I took a look at Excel's internal representation of built-in format 0x2c and it
is different again:
_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)

It has the spaces after the asterisks, but it also has quotes around the
currency and backslashes before some round brackets.

I've compared the formats produced in a new file created by Excel, and one
created by POI.  They are the same. You can see POI's code for creating format
0x2c on line 1269 of the following:
http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/model/Workbook.java?annotate=764203

As far as I can tell, this discrepancy won't cause POI to read or write xls
files incorrectly.

Perhaps you have a different use case which relies on the value returned by
HSSFDataFormat.getFormat(short).  If so, can you please describe *that* in more
detail? This will help write a junit that verifies the need for this code
change.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org