aboutsummaryrefslogtreecommitdiffstats
path: root/poi-ooxml/src
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2021-10-25 10:11:04 +0000
committerPJ Fanning <fanningpj@apache.org>2021-10-25 10:11:04 +0000
commitecdd4fcb5518da487784cd6c664f4d76029e8d52 (patch)
treef18036445917c2a175f4b195b26fb4732d4b7340 /poi-ooxml/src
parent6017327bae3201a96cdbcdc1d809453e9dba8182 (diff)
downloadpoi-ecdd4fcb5518da487784cd6c664f4d76029e8d52.tar.gz
poi-ecdd4fcb5518da487784cd6c664f4d76029e8d52.zip
revert github-267 due to broken tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1894550 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml/src')
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCell.java5
-rw-r--r--poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFFormulaParser.java45
2 files changed, 1 insertions, 49 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCell.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCell.java
index fcdd530be8..a1d33c9600 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCell.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCell.java
@@ -474,10 +474,7 @@ public final class XSSFCell extends CellBase {
if (wb.getCellFormulaValidation()) {
XSSFEvaluationWorkbook fpb = XSSFEvaluationWorkbook.create(wb);
//validate through the FormulaParser
- Ptg[] ptgs = FormulaParser.parse(formula, fpb, formulaType, wb.getSheetIndex(getSheet()), getRowIndex());
- // Make its format consistent with Excel.
- // eg: "SUM('Sheet1:Sheet2'!A1:B1)" will be trans to "SUM(Sheet1:Sheet2!A1:B1)"
- formula = FormulaRenderer.toFormulaString(fpb, ptgs);
+ FormulaParser.parse(formula, fpb, formulaType, wb.getSheetIndex(getSheet()), getRowIndex());
}
CTCellFormula f;
diff --git a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFFormulaParser.java b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFFormulaParser.java
index 120184b681..7b56cf8965 100644
--- a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFFormulaParser.java
+++ b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFFormulaParser.java
@@ -723,49 +723,4 @@ public final class TestXSSFFormulaParser {
wb.close();
}
-
- @Test
- void testQuotedSheetNamesReference() {
- // quoted sheet names bug fix (https://github.com/apache/poi/pull/267)
- Workbook[] wbs = new Workbook[]{new HSSFWorkbook(), new XSSFWorkbook()};
- for (Workbook wb : wbs) {
- Sheet sheet1 = wb.createSheet("Sheet1");
- Sheet sheet2 = wb.createSheet("Sheet2");
- Sheet sheet3 = wb.createSheet("Sheet 3");
-
- Row tempRow = sheet1.createRow(0);
- tempRow.createCell(0).setCellValue(1);
- tempRow.createCell(1).setCellValue(2);
-
- tempRow = sheet2.createRow(0);
- tempRow.createCell(0).setCellValue(3);
- tempRow.createCell(1).setCellValue(4);
-
- tempRow = sheet3.createRow(0);
- tempRow.createCell(0).setCellValue(5);
- tempRow.createCell(1).setCellValue(6);
-
- Cell cell = tempRow.createCell(2);
-
- // unquoted sheet names
- String formula = "SUM(Sheet1:Sheet2!A1:B1)";
- cell.setCellFormula(formula);
- String cellFormula = cell.getCellFormula();
- assertEquals(formula, cellFormula);
-
- // quoted sheet names with no space
- cell = tempRow.createCell(3);
- formula = "SUM('Sheet1:Sheet2'!A1:B1)";
- cell.setCellFormula(formula);
- cellFormula = cell.getCellFormula();
- assertEquals("SUM(Sheet1:Sheet2!A1:B1)", cellFormula);
-
- // quoted sheet names with space
- cell = tempRow.createCell(4);
- formula = "SUM('Sheet1:Sheet 3'!A1:B1)";
- cell.setCellFormula(formula);
- cellFormula = cell.getCellFormula();
- assertEquals(formula, cellFormula);
- }
- }
}