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/11/02 07:40:45 UTC
[Bug 58571] New: Date formatting in formulas does not support
double-quotes as escape-character as Excel does
https://bz.apache.org/bugzilla/show_bug.cgi?id=58571
Bug ID: 58571
Summary: Date formatting in formulas does not support
double-quotes as escape-character as Excel does
Product: POI
Version: 3.14-dev
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: SS Common
Assignee: dev@poi.apache.org
Reporter: dominik.stadler@gmx.at
This is a followup from Bug 54786, the fix applied there is not complete yet,
the following unit-test still fails:
@Test
public void testFormula() throws IOException {
try (Workbook wb = new XSSFWorkbook()) {
FormulaEvaluator eval =
wb.getCreationHelper().createFormulaEvaluator();
Sheet sheet = wb.createSheet("test");
Row row = sheet.createRow(0);
Cell cell = row.createCell(0);
cell.setCellFormula("TEXT(B1, \"[h]\"\"h\"\" m\"\"m\"\"\")");
Cell cellValue = row.createCell(1);
cellValue.setCellValue(0.0104166666666666);;
CellValue value = eval.evaluate(cell);
assertEquals(Cell.CELL_TYPE_STRING, value.getCellType());
assertEquals("1h 0m", value.getStringValue());
}
}
It seems the StringPtg internally stores the two double quotes ("") as one
double quote and the format is passed this way to the TEXT-function and further
on to DataFormatter.formatRawCellContents(). However in Bug 54786 we built the
replacement there on two doulbe-quotes.
Two options:
* Adjust DataFormatter to replace one double quote with a single quote
* Adjust StringPtg to return the doulbe-quotes in the call to getValue()
similar to toString()/toFormulaString()
I am not sure which one is the better option here as both may have side-effects
to existing code/functionality.
--
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 58571] Date formatting in formulas does not support
double-quotes as escape-character as Excel does
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58571
Dominik Stadler <do...@gmx.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
OS| |All
--
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 58571] Date formatting in formulas does not support double-quotes as escape-character as Excel does
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58571
Dominik Stadler <do...@gmx.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |WONTFIX
--- Comment #1 from Dominik Stadler <do...@gmx.at> ---
It seems POI applies unquoting of two double-quotes at some point.
Fully fixing this seems quite hard, therefore I close this as WONTFIX for now.
However I found a workaround by using four double-quotes when adding the
formula, this is shown in the test-case in r1923053.
--
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