diff --git a/poi-ooxml/src/test/java/org/apache/poi/xssf/extractor/TestXSSFEventBasedExcelExtractor.java b/poi-ooxml/src/test/java/org/apache/poi/xssf/extractor/TestXSSFEventBasedExcelExtractor.java index accaae3bea..fe543ef37b 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/xssf/extractor/TestXSSFEventBasedExcelExtractor.java +++ b/poi-ooxml/src/test/java/org/apache/poi/xssf/extractor/TestXSSFEventBasedExcelExtractor.java @@ -362,4 +362,31 @@ class TestXSSFEventBasedExcelExtractor { assertContains(text, "Bob\tBob"); } } + + @Test + void test67784() throws Exception { + try (XSSFEventBasedExcelExtractor ex = + new XSSFEventBasedExcelExtractor( + XSSFTestDataSamples.openSamplePackage("bug67784.xlsx"))) { + String text = ex.getText().replace("\r", ""); + String[] lines = text.split("\n"); + assertEquals("FALSE", lines[2]); + assertEquals("TRUE", lines[3]); + assertEquals("ERROR:#DIV/0!", lines[4]); + } + } + + @Test + void test67784Formulas() throws Exception { + try (XSSFEventBasedExcelExtractor ex = + new XSSFEventBasedExcelExtractor( + XSSFTestDataSamples.openSamplePackage("bug67784.xlsx"))) { + ex.setFormulasNotResults(true); + String text = ex.getText().replace("\r", ""); + String[] lines = text.split("\n"); + assertEquals("(2 > 5)", lines[2]); + assertEquals("(2 < 4)", lines[3]); + assertEquals("10/0", lines[4]); + } + } } diff --git a/poi-ooxml/src/test/java/org/apache/poi/xssf/extractor/TestXSSFExcelExtractor.java b/poi-ooxml/src/test/java/org/apache/poi/xssf/extractor/TestXSSFExcelExtractor.java index 1e435753fa..40fc0602b7 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/xssf/extractor/TestXSSFExcelExtractor.java +++ b/poi-ooxml/src/test/java/org/apache/poi/xssf/extractor/TestXSSFExcelExtractor.java @@ -245,6 +245,17 @@ class TestXSSFExcelExtractor { //in the extracted text assertNotContained(text, "\u30CB\u30DB\u30F3"); } + } + @Test + void test67784Formulas() throws Exception { + try (XSSFExcelExtractor extractor = getExtractor("bug67784.xlsx")) { + extractor.setFormulasNotResults(true); + String text = extractor.getText().replace("\r", ""); + String[] lines = text.split("\n"); + assertEquals("(2 > 5)", lines[2]); + assertEquals("(2 < 4)", lines[3]); + assertEquals("10/0", lines[4]); + } } } diff --git a/test-data/spreadsheet/bug67784.xlsx b/test-data/spreadsheet/bug67784.xlsx new file mode 100644 index 0000000000..df5c63bc56 Binary files /dev/null and b/test-data/spreadsheet/bug67784.xlsx differ