poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 61701] XSSFName.getSheetName() throws when the named range refers to a formula with a Table range
Date Tue, 31 Oct 2017 09:40:46 GMT

--- Comment #1 from viktor@vaadin.com ---
UPD: The issue can be reproduced without using tables. The same exception is
thrown when a `Name` refers to a simple sum formula like "SUM($A$1:$C$1)".

The code below shows how to reproduce the issue without an excel file:

try {
    // Start with Creating a workbook and worksheet object
    XSSFWorkbook workbook = new XSSFWorkbook();
    XSSFSheet sheet = workbook.createSheet("Sheet1");

    // Create a row with a three number cells
    XSSFRow row = sheet.createRow(0);
    for (int i = 0; i < 3; i++) {
        XSSFCell cell = row.createCell(i);
        cell.setCellValue(i + 1);

    // Create a name referring to a formula
    Name name = workbook.createName();

        .getSheetName() returned: " + name.getSheetName());
} catch (Exception e) {

NOTE: it looks like in this case the error is in the
`org.apache.poi.ss.util.AreaReference#isContiguous` method which wrongly
returns true for formulas like "SUM(Table1[c])" and "SUM($A$1:$C$1)".

You are receiving this mail because:
You are the assignee for the bug.
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org

View raw message