Package io.keikai.axyra.sheets
Class NamedRange
java.lang.Object
io.keikai.axyra.sheets.NamedRange
A defined name (named range).
sheetScope is the 0-based sheet index it
is scoped to, or -1 for workbook scope.
Instances handed out by Workbook.names() and
Workbook.findName(String) stay attached to their workbook, so
asRange() resolves straight to the cells the name points at — a
template can be authored in Excel and filled in by key:
wb.findName("TaxRate").asRange().setFormula("=0.07");
CellValue[][] data = wb.findName("Inputs").asRange().values();
Two names are equal when their name, formula and scope match; the workbook they came from is not part of that comparison.
-
Constructor Summary
ConstructorsConstructorDescriptionNamedRange(String name, String formula, int sheetScope) A detached name — one that carries no workbook, soasRange()has nothing to resolve against. -
Method Summary
Modifier and TypeMethodDescriptionasRange()The cells this name points at.booleanformula()The formula the name resolves to — for a named range, a reference such as"Sheet1!$A$1:$B$10"; for a named constant, its value.inthashCode()booleanWhether this name is workbook-scoped (visible on every sheet).name()The defined name, as written in the workbook.intThe 0-based index of the sheet this name is scoped to, or-1.toString()
-
Constructor Details
-
NamedRange
A detached name — one that carries no workbook, soasRange()has nothing to resolve against. UseWorkbook.findName(String)to obtain an attached one.
-
-
Method Details
-
name
The defined name, as written in the workbook. -
formula
The formula the name resolves to — for a named range, a reference such as"Sheet1!$A$1:$B$10"; for a named constant, its value. -
sheetScope
public int sheetScope()The 0-based index of the sheet this name is scoped to, or-1. -
isWorkbookScoped
public boolean isWorkbookScoped()Whether this name is workbook-scoped (visible on every sheet). -
asRange
The cells this name points at.A sheet-scoped name whose formula carries no
Sheet!qualifier resolves against the sheet it is scoped to. Whole-column and whole-row names (Sheet1!$B:$B) expand to the grid's limits.- Throws:
IllegalStateException- if this name is detached from its workbook (built with the public constructor rather than read from a workbook)IllegalArgumentException- if the name does not resolve to a single rectangular area on a sheet of this workbook — a named constant, a multi-area union, an external or 3-D reference
-
equals
-
hashCode
public int hashCode() -
toString
-