59106: WorkdayFunction does not read the area with holidays correctly to calculate work days
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1753125 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
29b21a82f7
commit
0bf845e0cc
@ -86,7 +86,9 @@ final class ArgumentsEvaluator {
|
|||||||
AreaEvalBase area = (AreaEvalBase) arg;
|
AreaEvalBase area = (AreaEvalBase) arg;
|
||||||
for (int i = area.getFirstRow(); i <= area.getLastRow(); i++) {
|
for (int i = area.getFirstRow(); i <= area.getLastRow(); i++) {
|
||||||
for (int j = area.getFirstColumn(); j <= area.getLastColumn(); j++) {
|
for (int j = area.getFirstColumn(); j <= area.getLastColumn(); j++) {
|
||||||
valuesList.add(evaluateDateArg(area.getValue(i, j), i, j));
|
// getValue() is replaced with getAbsoluteValue() because loop variables i, j are
|
||||||
|
// absolute indexes values, but getValue() works with relative indexes values
|
||||||
|
valuesList.add(evaluateDateArg(area.getAbsoluteValue(i, j), i, j));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
double[] values = new double[valuesList.size()];
|
double[] values = new double[valuesList.size()];
|
||||||
|
@ -3078,4 +3078,17 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
|||||||
assertEquals(70, sheet.getLastRowNum());
|
assertEquals(70, sheet.getLastRowNum());
|
||||||
assertEquals(70, sheet.getRow(sheet.getLastRowNum()).getRowNum());
|
assertEquals(70, sheet.getRow(sheet.getLastRowNum()).getRowNum());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWorkdayFunction() throws IOException {
|
||||||
|
XSSFWorkbook workbook = XSSFTestDataSamples.openSampleWorkbook("59106.xlsx");
|
||||||
|
XSSFSheet sheet = workbook.getSheet("Test");
|
||||||
|
Row row = sheet.getRow(1);
|
||||||
|
Cell cell = row.getCell(0);
|
||||||
|
DataFormatter form = new DataFormatter();
|
||||||
|
FormulaEvaluator evaluator = cell.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator();
|
||||||
|
String result = form.formatCellValue(cell, evaluator);
|
||||||
|
|
||||||
|
assertEquals("09 Mar 2016", result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
BIN
test-data/spreadsheet/59106.xlsx
Normal file
BIN
test-data/spreadsheet/59106.xlsx
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user