aboutsummaryrefslogtreecommitdiffstats
path: root/poi-ooxml/src
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2023-12-10 13:30:59 +0000
committerPJ Fanning <fanningpj@apache.org>2023-12-10 13:30:59 +0000
commitf662657db1b2f34c56437b51a5af9ddfc49851b7 (patch)
tree11dbad7c5857239d4633e38986dc63a2875b3c17 /poi-ooxml/src
parent2c838143baaa16eaa52231397f1ea85dc849c7b1 (diff)
downloadpoi-f662657db1b2f34c56437b51a5af9ddfc49851b7.tar.gz
poi-f662657db1b2f34c56437b51a5af9ddfc49851b7.zip
[bug-68305] add test
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1914511 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml/src')
-rw-r--r--poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.java b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.java
index 9f66adffcc..220190d453 100644
--- a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.java
+++ b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFFormulaEvaluation.java
@@ -114,6 +114,21 @@ public final class TestXSSFFormulaEvaluation extends BaseTestFormulaEvaluator {
}
}
+ @Test
+ void testEvaluateFormulaWithSheetRefEscapedApostrophe() throws IOException {
+ // https://bz.apache.org/bugzilla/show_bug.cgi?id=68305
+ try (XSSFWorkbook wb = new XSSFWorkbook()) {
+ XSSFSheet sheet1 = wb.createSheet("Sheet1");
+ XSSFSheet sheet2 = wb.createSheet("(2) 4-Tension Bolt MC's");
+ sheet2.createRow(0).createCell(0).setCellValue(1.0);
+ XSSFCell xssfCell = sheet1.createRow(0).createCell(0);
+ xssfCell.setCellFormula("'(2) 4-Tension Bolt MC''s'!A1");
+ XSSFFormulaEvaluator xssfFormulaEvaluator = new XSSFFormulaEvaluator(wb);
+ xssfFormulaEvaluator.evaluateInCell(xssfCell);
+ assertEquals(1.0, xssfCell.getNumericCellValue());
+ }
+ }
+
/**
* Related to bugs #56737 and #56752 - XSSF workbooks which have
* formulas that refer to cells and named ranges in multiple other