diff --git a/poi-ooxml/src/test/java/org/apache/poi/xssf/TestXLookupFunction.java b/poi-ooxml/src/test/java/org/apache/poi/xssf/TestXSSFXLookupFunction.java similarity index 81% rename from poi-ooxml/src/test/java/org/apache/poi/xssf/TestXLookupFunction.java rename to poi-ooxml/src/test/java/org/apache/poi/xssf/TestXSSFXLookupFunction.java index 16122cfffc..dbe7c956fc 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/xssf/TestXLookupFunction.java +++ b/poi-ooxml/src/test/java/org/apache/poi/xssf/TestXSSFXLookupFunction.java @@ -31,7 +31,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; /** * Testcase for function XLOOKUP() */ -public class TestXLookupFunction { +public class TestXSSFXLookupFunction { //https://support.microsoft.com/en-us/office/xlookup-function-b7fd680e-6d10-43e6-84f9-88eae8bf5929 @@ -52,6 +52,20 @@ public class TestXLookupFunction { } } + @Test + void testXLookupFile() throws Exception { + try (XSSFWorkbook workbook = XSSFTestDataSamples.openSampleWorkbook("xlookup.xlsx")) { + XSSFSheet sheet = workbook.getSheetAt(0); + XSSFFormulaEvaluator fe = new XSSFFormulaEvaluator(workbook); + XSSFRow row1 = sheet.getRow(1); + assertEquals("Dianne Pugh", row1.getCell(2).getStringCellValue()); + assertEquals("Finance", row1.getCell(3).getStringCellValue()); + fe.evaluateAll(); + row1 = sheet.getRow(1); + assertEquals("Dianne Pugh", row1.getCell(2).getStringCellValue()); + assertEquals("Finance", row1.getCell(3).getStringCellValue()); + } + } private XSSFWorkbook initWorkbook2() { XSSFWorkbook wb = new XSSFWorkbook(); diff --git a/test-data/spreadsheet/xlookup.xlsx b/test-data/spreadsheet/xlookup.xlsx new file mode 100644 index 0000000000..58b6ae9bc8 Binary files /dev/null and b/test-data/spreadsheet/xlookup.xlsx differ