Package org.apache.poi.ss.util
Class CellRangeAddressList
- java.lang.Object
-
- org.apache.poi.ss.util.CellRangeAddressList
-
- All Implemented Interfaces:
GenericRecord
public class CellRangeAddressList extends Object implements GenericRecord
Implementation of the cell range address lists,like is described in OpenOffice.org's Excel Documentation: excelfileformat.pdf sec 2.5.14 - 'Cell Range Address List' In BIFF8 there is a common way to store absolute cell range address lists in several records (not formulas). A cell range address list consists of a field with the number of ranges and the list of the range addresses. Each cell range address (called an ADDR structure) contains 4 16-bit-values.
-
-
Field Summary
Fields Modifier and Type Field Description protected List<CellRangeAddress>
_list
List ofCellRangeAddress
es.
-
Constructor Summary
Constructors Constructor Description CellRangeAddressList()
CellRangeAddressList(int firstRow, int lastRow, int firstCol, int lastCol)
Convenience constructor for creating aCellRangeAddressList
with a singleCellRangeAddress
.CellRangeAddressList(RecordInputStream in)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCellRangeAddress(int firstRow, int firstCol, int lastRow, int lastCol)
Add a cell range structure.void
addCellRangeAddress(CellRangeAddress cra)
CellRangeAddressList
copy()
int
countRanges()
Get the number of following ADDR structures.CellRangeAddress
getCellRangeAddress(int index)
CellRangeAddress[]
getCellRangeAddresses()
static int
getEncodedSize(int numberOfRanges)
List<CellRangeAddress>
getGenericChildren()
Map<String,Supplier<?>>
getGenericProperties()
int
getSize()
CellRangeAddress
remove(int rangeIndex)
int
serialize(int offset, byte[] data)
void
serialize(LittleEndianOutput out)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.poi.common.usermodel.GenericRecord
getGenericRecordType
-
-
-
-
Field Detail
-
_list
protected final List<CellRangeAddress> _list
List ofCellRangeAddress
es. Each structure represents a cell range
-
-
Constructor Detail
-
CellRangeAddressList
public CellRangeAddressList()
-
CellRangeAddressList
public CellRangeAddressList(int firstRow, int lastRow, int firstCol, int lastCol)
Convenience constructor for creating aCellRangeAddressList
with a singleCellRangeAddress
. OtherCellRangeAddress
es may be added later.
-
CellRangeAddressList
public CellRangeAddressList(RecordInputStream in)
- Parameters:
in
- the RecordInputstream to read the record from
-
-
Method Detail
-
countRanges
public int countRanges()
Get the number of following ADDR structures. The number of this structures is automatically set when reading an Excel file and/or increased when you manually add a new ADDR structure . This is the reason there isn't a set method for this field .- Returns:
- number of ADDR structures
-
addCellRangeAddress
public void addCellRangeAddress(int firstRow, int firstCol, int lastRow, int lastCol)
Add a cell range structure.- Parameters:
firstRow
- - the upper left hand corner's rowfirstCol
- - the upper left hand corner's collastRow
- - the lower right hand corner's rowlastCol
- - the lower right hand corner's col
-
addCellRangeAddress
public void addCellRangeAddress(CellRangeAddress cra)
-
remove
public CellRangeAddress remove(int rangeIndex)
-
getCellRangeAddress
public CellRangeAddress getCellRangeAddress(int index)
- Returns:
CellRangeAddress
at the given index
-
getSize
public int getSize()
-
getEncodedSize
public static int getEncodedSize(int numberOfRanges)
- Returns:
- the total size of for the specified number of ranges, including the initial 2 byte range count
-
serialize
public int serialize(int offset, byte[] data)
-
serialize
public void serialize(LittleEndianOutput out)
-
copy
public CellRangeAddressList copy()
-
getCellRangeAddresses
public CellRangeAddress[] getCellRangeAddresses()
-
getGenericProperties
public Map<String,Supplier<?>> getGenericProperties()
- Specified by:
getGenericProperties
in interfaceGenericRecord
-
getGenericChildren
public List<CellRangeAddress> getGenericChildren()
- Specified by:
getGenericChildren
in interfaceGenericRecord
-
-