https://bz.apache.org/bugzilla/show_bug.cgi?id=68305
[email protected] changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |NEW --- Comment #4 from [email protected] --- I could reproduce this with the following code import org.apache.poi.ss.usermodel.*; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; import java.io.IOException; class PoiApostropheFormulaTest { @Test void evaluateAll_shouldNotThrow_whenNameFormulaReferencesSheetWithApostrophe() throws IOException { try (Workbook workbook = createWorkbookWithApostropheNameFormula()) { FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator(); // This call throws IllegalArgumentException: Invalid sheetIndex evaluator.evaluateAll(); } } private static Workbook createWorkbookWithApostropheNameFormula() { Workbook workbook = new XSSFWorkbook(); // Sheet name containing an apostrophe Sheet dataSheet = workbook.createSheet("L'embrace"); dataSheet.createRow(0).createCell(0).setCellValue(42); // Defined name pointing at the apostrophe sheet, correctly escaped per Excel syntax Name name = workbook.createName(); name.setNameName("myLocalName"); name.setRefersToFormula("'L''embrace'!$A$1"); name.setSheetIndex(workbook.getSheetIndex(dataSheet)); dataSheet.getRow(0).createCell(1).setCellFormula("myLocalName"); return workbook; } } -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
