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

--- Comment #5 from Eric Peters <[email protected]> ---
@Nick I guess this might be more complicated, but the patch holds up.

I am creating the .xls files using Office 2010 in a Save As... environment, I
hope that's not the issue.  It would seem to me the patch I have for
BuiltinFormats.java is consistent with what's in the original javadoc.


THe XSSF Code seems to re-use the same BuiltinFormats via
org.apache.poi.xssf.usermodel.XSSFCellStyle

    public String getFormat(short index) {
        String fmt = stylesSource.getNumberFormatAt(index);
        if(fmt == null) fmt = BuiltinFormats.getBuiltinFormat(index);
        return fmt;
    }

That said once I poked into the file I saw:
<numFmts count="4">
    <numFmt numFmtId="44" formatCode="_(&quot;$&quot;*
#,##0.00_);_(&quot;$&quot;* \(#,##0.00\);_(&quot;$&quot;*
&quot;-&quot;??_);_(@_)"/>
    <numFmt numFmtId="43" formatCode="_(* #,##0.00_);_(* \(#,##0.00\);_(*
&quot;-&quot;??_);_(@_)"/>
    <numFmt numFmtId="171" formatCode="_-[$£-809]* #,##0.00_-;\-[$£-809]*
#,##0.00_-;_-[$£-809]* &quot;-&quot;??_-;_-@_-"/>
    <numFmt numFmtId="172" formatCode="_ [$¥-804]* #,##0.00_ ;_ [$¥-804]*
\-#,##0.00_ ;_ [$¥-804]* &quot;-&quot;??_ ;_ @_ "/>
</numFmts>

So it looks like Excel 2010 wrote the proper format code into the file
directly, so XSSF skips BuiltinFormats in this case.

My Original Unit Test was:

HSSF:
  Vector(Vector($4.79, * 4.79)) did not equal Vector(Vector(4.79, $4.79)) 
(TestExcelFlatFileReaderCommon.scala:37)
XSSF:
  Vector(Vector(* 4.79, $4.79)) did not equal Vector(Vector(4.79, $4.79))
(TestExcelFlatFileReaderCommon.scala:37)

That makes a lot more sense now why one would show one thing, and the other
something else.

The underlying problem here is the DataFormatter isn't supporting the Format
Index: 43 properly with that *<space>, but that's a separate issue than
correcting the HSSF.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to