Top Description Fields Constructors Methods
org.apache.poi.ss.util

public Class CellRangeAddress

extends CellRangeAddressBase
Class Inheritance
Imports
org.apache.poi.hssf.record.RecordInputStream, .SelectionRecord, org.apache.poi.ss.formula.SheetNameFormatter, org.apache.poi.util.LittleEndianOutput

See OOO documentation: excelfileformat.pdf sec 2.5.14 - 'Cell Range Address'

In the Microsoft documentation, this is also known as a Ref8U - see page 831 of version 1.0 of the documentation. Note - SelectionRecord uses the BIFF5 version of this structure

Field Summary

Modifier and TypeField and Description
public static final int

Constructor Summary

AccessConstructor and Description
public
CellRangeAddress(int
Index of first row
firstRow
,
int
Index of last row (inclusive), must be equal to or larger than firstRow
lastRow
,
int
Index of first column
firstCol
,
int
Index of last column (inclusive), must be equal to or larger than firstCol
lastCol
)

Creates new cell range.

public

Method Summary

Modifier and TypeMethod and Description
public CellRangeAddress
public String

Returns:

the text format of this range. Single cell ranges are formatted like single cell references (e.g. 'A1' instead of 'A1:A1').
formatAsString
()

public String

Returns:

the text format of this range using specified sheet name.
formatAsString
(String sheetName, boolean useAbsoluteAddress)

public static int
getEncodedSize(int numberOfItems)

private static int
public void
public static CellRangeAddress
valueOf(String
usually a standard area ref (e.g. "B1:D8"). May be a single cell ref (e.g. "B5") in which case the result is a 1 x 1 cell range. May also be a whole row range (e.g. "3:5"), or a whole column range (e.g. "C:F")
ref
)

Creates a CellRangeAddress from a cell range reference string.

Inherited from org.apache.poi.ss.util.CellRangeAddressBase:
containsColumncontainsRowequalsgetFirstColumngetFirstRowgetGenericPropertiesgetLastColumngetLastRowgetMaxColumngetMaxRowgetMinColumngetMinRowgetNumberOfCellsgetPositionhashCodeintersectsisFullColumnRangeisFullRowRangeisInRangeisInRangeisInRangeisInRangeiteratorsetFirstColumnsetFirstRowsetLastColumnsetLastRowspliteratortoStringvalidate

Field Detail

ENCODED_SIZEback to summary
public static final int ENCODED_SIZE

Constructor Detail

CellRangeAddressback to summary
public CellRangeAddress(int firstRow, int lastRow, int firstCol, int lastCol)

Creates new cell range. Indexes are zero-based.

Parameters
firstRow:int

Index of first row

lastRow:int

Index of last row (inclusive), must be equal to or larger than firstRow

firstCol:int

Index of first column

lastCol:int

Index of last column (inclusive), must be equal to or larger than firstCol

CellRangeAddressback to summary
public CellRangeAddress(RecordInputStream in)

Method Detail

copyback to summary
public CellRangeAddress copy()

Implements org.apache.poi.common.Duplicatable.copy.

Returns:CellRangeAddress

Doc from org.apache.poi.common.Duplicatable.copy.

a deep copy of the implementing class / instance

Annotations
@Override
formatAsStringback to summary
public String formatAsString()
Returns:String

the text format of this range. Single cell ranges are formatted like single cell references (e.g. 'A1' instead of 'A1:A1').

formatAsStringback to summary
public String formatAsString(String sheetName, boolean useAbsoluteAddress)
Returns:String

the text format of this range using specified sheet name.

getEncodedSizeback to summary
public static int getEncodedSize(int numberOfItems)
readUShortAndCheckback to summary
private static int readUShortAndCheck(RecordInputStream in)
serializeback to summary
public void serialize(LittleEndianOutput out)
valueOfback to summary
public static CellRangeAddress valueOf(String ref)

Creates a CellRangeAddress from a cell range reference string.

Parameters
ref:String

usually a standard area ref (e.g. "B1:D8"). May be a single cell ref (e.g. "B5") in which case the result is a 1 x 1 cell range. May also be a whole row range (e.g. "3:5"), or a whole column range (e.g. "C:F")