mirror of
https://github.com/apache/poi.git
synced 2026-02-27 20:40:08 +08:00
add data-formatter test
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1895706 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ea9883af55
commit
a24820e629
@ -107,4 +107,17 @@ public final class TestXSSFDataFormat extends BaseTestDataFormat {
|
||||
assertEquals("1000", formatter.formatCellValue(cell, evaluator));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSetUseCachedValuesForFormulaCells() throws Exception {
|
||||
try (XSSFWorkbook wb = openSampleWorkbook("formula-eval.xlsx")) {
|
||||
final DataFormatter formatter = new DataFormatter();
|
||||
XSSFSheet sheet = wb.getSheetAt(0);
|
||||
XSSFRow row = sheet.getRow(0);
|
||||
XSSFCell d1 = row.getCell(3);
|
||||
assertEquals("SUM(A1:C1)", formatter.formatCellValue(d1));
|
||||
formatter.setUseCachedValuesForFormulaCells(true);
|
||||
assertEquals("6.75", formatter.formatCellValue(d1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BIN
test-data/spreadsheet/formula-eval.xlsx
Normal file
BIN
test-data/spreadsheet/formula-eval.xlsx
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user