poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cen...@apache.org
Subject svn commit: r1753125 - in /poi/trunk: src/java/org/apache/poi/ss/formula/atp/ArgumentsEvaluator.java src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java test-data/spreadsheet/59106.xlsx
Date Sun, 17 Jul 2016 21:18:27 GMT
Author: centic
Date: Sun Jul 17 21:18:27 2016
New Revision: 1753125

URL: http://svn.apache.org/viewvc?rev=1753125&view=rev
Log:
59106: WorkdayFunction does not read the area with holidays correctly to calculate work days

Added:
    poi/trunk/test-data/spreadsheet/59106.xlsx
Modified:
    poi/trunk/src/java/org/apache/poi/ss/formula/atp/ArgumentsEvaluator.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/atp/ArgumentsEvaluator.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/atp/ArgumentsEvaluator.java?rev=1753125&r1=1753124&r2=1753125&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/atp/ArgumentsEvaluator.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/atp/ArgumentsEvaluator.java Sun Jul 17 21:18:27
2016
@@ -86,7 +86,9 @@ final class ArgumentsEvaluator {
             AreaEvalBase area = (AreaEvalBase) arg;
             for (int i = area.getFirstRow(); i <= area.getLastRow(); i++) {
                 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()];

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java?rev=1753125&r1=1753124&r2=1753125&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java Sun Jul
17 21:18:27 2016
@@ -3078,4 +3078,17 @@ public final class TestXSSFBugs extends
         assertEquals(70, sheet.getLastRowNum());
         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);
+    }
 }

Added: poi/trunk/test-data/spreadsheet/59106.xlsx
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/59106.xlsx?rev=1753125&view=auto
==============================================================================
Binary files poi/trunk/test-data/spreadsheet/59106.xlsx (added) and poi/trunk/test-data/spreadsheet/59106.xlsx
Sun Jul 17 21:18:27 2016 differ



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message