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 2015/12/29 00:07:36 UTC

[Bug 58778] New: Override built-in number format

https://bz.apache.org/bugzilla/show_bug.cgi?id=58778

            Bug ID: 58778
           Summary: Override built-in number format
           Product: POI
           Version: 3.14-dev
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: onealj@apache.org

It looks like POI cannot override a built-in number format. The workbook must
have been saved (by Excel) with an overridden built-in number format.

From
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDataFormat.java?revision=1721923&view=markup#l35
> global String poundFmt = "\"\u00a3\"#,##0;[Red]\\-\"\u00a3\"#,##0";
> global short expectedPoundFmtIdx = 6;
> // Read in a workbook where a currency format has been overridden to use the £ symbol in place of the $ symbol. The default built-in format is "$#,##0_);[Red]($#,##0)"
> XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("49928.xlsx"); 
> DataFormat dataFormat = wb.createDataFormat();
> short poundFmtIdx = wb.getSheetAt(0).getRow(0).getCell(0).getCellStyle().getDataFormat();
> assertEquals(poundFmtIdx, dataFormat.getFormat(poundFmt));

This could be fixed by adding
void XSSFDataFormat#putFormat(int index, String format).
Am I correct that it isn't possible to override custom data formats in
XSSFWorkbooks in POI?

I'm also curious why the built-in formats don't have a leading opening
parentheses. Seems like they should match up. If so, that could be a different
bug.

-- 
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


[Bug 58778] Override built-in number format

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58778

Javen O'Neal <on...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #1 from Javen O'Neal <on...@apache.org> ---
Patch applied in r1722043.
Docs updated in r1722044.

Please revert this patch if there is already a way to override built-in number
formats in POI.

-- 
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