poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 61701] New: XSSFName.getSheetName() throws when the named range refers to a formula with a Table range
Date Tue, 31 Oct 2017 08:34:10 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=61701

            Bug ID: 61701
           Summary: XSSFName.getSheetName() throws when the named range
                    refers to a formula with a Table range
           Product: POI
           Version: 3.17-FINAL
          Hardware: Macintosh
                OS: Mac OS X 10.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: viktor@vaadin.com
  Target Milestone: ---

Created attachment 35478
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35478&action=edit
simple-table-named-range.xlsx

When a named range is defined as a reference to the formula 'SUM(Table1[c])',
calling `name.getSheetName()` throws an IllegalArgumentException.

java.lang.IllegalArgumentException: Invalid CellReference: SUM(Table1[c])
        at
org.apache.poi.ss.util.CellReference.separateRefParts(CellReference.java:395)
        at org.apache.poi.ss.util.CellReference.<init>(CellReference.java:113)
        at org.apache.poi.ss.util.AreaReference.<init>(AreaReference.java:60)
        at
org.apache.poi.xssf.usermodel.XSSFName.getSheetName(XSSFName.java:295)

Full source code to reproduce the issue:

public class Main {
    public static void main(String argv[]) {
        System.out.println("POI 3.17");
        try {
            InputStream input =
Main.class.getClassLoader().getResourceAsStream("simple-table-named-range.xlsx");
            Workbook workbook = WorkbookFactory.create(input);
            Name name = workbook.getName("total");
            System.out.println("workbook.getName(\"total\").getSheetName()
returned: " + name.getSheetName());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

The Excel file used in this sample is attached.

-- 
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


Mime
View raw message