Package org.apache.poi.xssf.streaming
Class SXSSFRow
java.lang.Object
org.apache.poi.xssf.streaming.SXSSFRow
- All Implemented Interfaces:
Comparable<SXSSFRow>,Iterable<Cell>,Row
Streaming version of XSSFRow implementing the "BigGridDemo" strategy.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassreturns all cells including empty cells (nullvalues are returned for empty cells).classCreate an iterator over the cells from [0, getLastCellNum()).Nested classes/interfaces inherited from interface org.apache.poi.ss.usermodel.Row
Row.MissingCellPolicy -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintCompares twoSXSSFRowobjects.createCell(int column) Use this to create new cells within the row and return it.createCell(int column, CellType type) Use this to create new cells within the row and return it.booleangetCell(int cellnum) Get the cell representing a given column (logical cell) 0-based.getCell(int cellnum, Row.MissingCellPolicy policy) Returns the cell at the given (0 based) index, with the specifiedRow.MissingCellPolicyshortGet the number of the first cell contained in this row.shortGet the row's height measured in twips (1/20th of a point).floatReturns row height measured in point size.get row hidden state: Hidden (true), Unhidden (false), Undefined (null)shortGets the index of the last cell contained in this row PLUS ONE.intReturns the rows outline level.intGets the number of defined cells (NOT number of cells in the actual row!).intGet row number this row representsReturns the whole-row cell style.getSheet()Returns the Sheet this row belongs tobooleanGet whether or not to display this row with 0 heightbooleaninthashCode()booleanIs this row formatted? Most aren't, but some rows do have whole-row styles.iterator()voidremoveCell(Cell cell) Remove the Cell from this row.voidsetCollapsed(Boolean collapsed) voidsetHeight(short height) Set the row's height or set to ff (-1) for undefined/default-height.voidsetHeightInPoints(float height) Set the row's height in points.voidset row hidden state: Hidden (true), Unhidden (false), Undefined (null)voidsetRowNum(int rowNum) Set the row number of this row.voidsetRowStyle(CellStyle style) Applies a whole-row cell styling to the row.voidsetZeroHeight(boolean zHeight) Set whether or not to display this row with 0 heightvoidshiftCellsLeft(int firstShiftColumnIndex, int lastShiftColumnIndex, int step) voidshiftCellsRight(int firstShiftColumnIndex, int lastShiftColumnIndex, int step) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
SXSSFRow
-
-
Method Details
-
allCellsIterator
-
hasCustomHeight
public boolean hasCustomHeight() -
getOutlineLevel
public int getOutlineLevel()Description copied from interface:RowReturns the rows outline level. Increased as you put it into more groups (outlines), reduced as you take it out of them.- Specified by:
getOutlineLevelin interfaceRow
-
getHidden
get row hidden state: Hidden (true), Unhidden (false), Undefined (null)- Returns:
- row hidden state
-
setHidden
set row hidden state: Hidden (true), Unhidden (false), Undefined (null)- Parameters:
hidden- row hidden state
-
getCollapsed
-
setCollapsed
-
iterator
-
createCell
Use this to create new cells within the row and return it.The cell that is returned is a
CellType.BLANK. The type can be changed either through callingsetCellValueorsetCellType.- Specified by:
createCellin interfaceRow- Parameters:
column- - the column number this cell represents- Returns:
- Cell a high level representation of the created cell.
- Throws:
IllegalArgumentException- if columnIndex < 0 or greater than the maximum number of supported columns (255 for *.xls, 1048576 for *.xlsx)
-
createCell
Use this to create new cells within the row and return it.The cell that is returned is a
CellType.BLANK. The type can be changed either through calling setCellValue or setCellType.- Specified by:
createCellin interfaceRow- Parameters:
column- - the column number this cell representstype- - the cell's data type- Returns:
- Cell a high level representation of the created cell.
- Throws:
IllegalArgumentException- if columnIndex < 0 or greater than a maximum number of supported columns (255 for *.xls, 1048576 for *.xlsx)
-
removeCell
Remove the Cell from this row.- Specified by:
removeCellin interfaceRow- Parameters:
cell- the cell to remove
-
setRowNum
public void setRowNum(int rowNum) Set the row number of this row.- Specified by:
setRowNumin interfaceRow- Parameters:
rowNum- the row number (0-based)- Throws:
IllegalArgumentException- if rowNum < 0
-
getRowNum
public int getRowNum()Get row number this row represents -
getCell
Get the cell representing a given column (logical cell) 0-based. If cell is missing or blank, uses the workbook's MissingCellPolicy to determine the return value.- Specified by:
getCellin interfaceRow- Parameters:
cellnum- 0 based column number- Returns:
- Cell representing that column or null if undefined.
- Throws:
RuntimeException- if cellnum is out of bounds- See Also:
-
getCell
Returns the cell at the given (0 based) index, with the specifiedRow.MissingCellPolicy- Specified by:
getCellin interfaceRow- Returns:
- the cell at the given (0 based) index
- Throws:
IllegalArgumentException- if cellnum < 0 or the specified MissingCellPolicy is invalid
-
getFirstCellNum
public short getFirstCellNum()Get the number of the first cell contained in this row.- Specified by:
getFirstCellNumin interfaceRow- Returns:
- short representing the first logical cell in the row, or -1 if the row does not contain any cells.
-
getLastCellNum
public short getLastCellNum()Gets the index of the last cell contained in this row PLUS ONE. The result also happens to be the 1-based column number of the last cell. This value can be used as a standard upper bound when iterating over cells:short minColIx = row.getFirstCellNum(); short maxColIx = row.getLastCellNum(); for(short colIx=minColIx; colIx<maxColIx; colIx++) { Cell cell = row.getCell(colIx); if(cell == null) { continue; } //... do something with cell }- Specified by:
getLastCellNumin interfaceRow- Returns:
- short representing the last logical cell in the row PLUS ONE, or -1 if the row does not contain any cells.
-
getPhysicalNumberOfCells
public int getPhysicalNumberOfCells()Gets the number of defined cells (NOT number of cells in the actual row!). That is to say if only columns 0,4,5 have values then there would be 3.- Specified by:
getPhysicalNumberOfCellsin interfaceRow- Returns:
- int representing the number of defined cells in the row.
-
setHeight
public void setHeight(short height) Set the row's height or set to ff (-1) for undefined/default-height. Set the height in "twips" or 1/20th of a point. -
setZeroHeight
public void setZeroHeight(boolean zHeight) Set whether or not to display this row with 0 height- Specified by:
setZeroHeightin interfaceRow- Parameters:
zHeight- height is zero or not.
-
getZeroHeight
public boolean getZeroHeight()Get whether or not to display this row with 0 height- Specified by:
getZeroHeightin interfaceRow- Returns:
- - zHeight height is zero or not.
-
setHeightInPoints
public void setHeightInPoints(float height) Set the row's height in points.- Specified by:
setHeightInPointsin interfaceRow- Parameters:
height- the height in points.-1resets to the default height
-
getHeight
public short getHeight()Get the row's height measured in twips (1/20th of a point). If the height is not set, the default worksheet value is returned, SeeSheet.getDefaultRowHeightInPoints() -
getHeightInPoints
public float getHeightInPoints()Returns row height measured in point size. If the height is not set, the default worksheet value is returned, SeeSheet.getDefaultRowHeightInPoints()- Specified by:
getHeightInPointsin interfaceRow- Returns:
- row height measured in point size
- See Also:
-
isFormatted
public boolean isFormatted()Is this row formatted? Most aren't, but some rows do have whole-row styles. For those that do, you can get the formatting fromgetRowStyle()- Specified by:
isFormattedin interfaceRow
-
getRowStyle
Returns the whole-row cell style. Most rows won't have one of these, so will return null. CallisFormatted()to check first.- Specified by:
getRowStylein interfaceRow
-
setRowStyle
Applies a whole-row cell styling to the row. The row style can be cleared by passing innull.- Specified by:
setRowStylein interfaceRow
-
cellIterator
- Specified by:
cellIteratorin interfaceRow- Returns:
- Cell iterator of the physically defined cells. Note element 4 may actually be row cell depending on how many are defined!
-
getSheet
Returns the Sheet this row belongs to -
compareTo
Compares twoSXSSFRowobjects. Two rows are equal if they belong to the same worksheet and their row indexes are equal.- Specified by:
compareToin interfaceComparable<SXSSFRow>- Parameters:
other- theSXSSFRowto be compared.- Returns:
-
the value
0if the row number of thisSXSSFRowis equal to the row number of the argumentSXSSFRow -
a value less than
0if the row number of this thisSXSSFRowis numerically less than the row number of the argumentSXSSFRow -
a value greater than
0if the row number of this thisSXSSFRowis numerically greater than the row number of the argumentSXSSFRow
-
the value
- Throws:
IllegalArgumentException- if the argument row belongs to a different worksheet
-
equals
-
hashCode
public int hashCode() -
shiftCellsRight
@NotImplemented public void shiftCellsRight(int firstShiftColumnIndex, int lastShiftColumnIndex, int step) - Specified by:
shiftCellsRightin interfaceRow
-
shiftCellsLeft
@NotImplemented public void shiftCellsLeft(int firstShiftColumnIndex, int lastShiftColumnIndex, int step) - Specified by:
shiftCellsLeftin interfaceRow
-