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: [email protected]
Reporter: [email protected]
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: [email protected]
For additional commands, e-mail: [email protected]