| Constructor and Description |
|---|
Sheet(SpreadsheetDocument parent,
int sheetIndex)
Creates a new Sheet instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addColumn(int startRow,
List<?> values)
Adds new column at the end of sheet and sets given values to it's cells starting from row defined
by
startRow. |
void |
addColumn(List<?> values)
Adds new column at the end of sheet and sets given values to it's cells starting from row with index 0.
|
void |
addColumn(String startRowRef,
List<?> values)
Adds new column at the end of sheet and sets given values to it's cells starting from row defined
by
startRowRef. |
void |
cleanColumn(Column column)
Removes all cells contained in the specified column of this sheet.
|
void |
cleanColumn(int colIndex)
Removes all cells contained in the specified column of this sheet.
|
void |
cleanColumn(String colRef)
Removes all cells contained in the specified column of this sheet.
|
void |
cleanRow(int rowIndex)
Removes all cells contained in the specified row of this sheet.
|
void |
cleanRow(Row row)
Removes all cells contained in the specified row of this sheet.
|
void |
cleanRow(String rowRef)
Removes all cells contained in the specified row of this sheet.
|
Sheet |
cloneAs(String clonedSheetName)
Clones this sheet and place it to the end of Spreadsheet document.
|
Sheet |
copyTo(SpreadsheetDocument destDoc)
Copies the content of this sheet to another sheet with the same format.
|
Row |
createRow(int rowIndex)
Creates a new row at the given index and return the high level representation.
|
Cell |
findCell(MatchMethod matchMethod,
String value)
Searches cell with given value on the sheet.
|
Cell |
findCell(String value)
Searches cell with given value on the sheet.
|
Row |
findRow(MatchMethod matchMethod,
String... values)
Searches row on the sheet with given values in cells.
|
Row |
findRow(String... values)
Searches row on the sheet with given values in cells.
|
<T> Table<T> |
findTable(Class<T> recordType,
MatchMethod matchMethod,
String... keywords)
Searches table on the sheet with given keywords in header.
|
<T> Table<T> |
findTable(Class<T> recordType,
String... keywords)
Searches table on the sheet with given keywords in header.
|
Cell |
getCell(int rowIndex,
int colIndex)
Gets the cell represented by given row and column indexes.
|
Cell |
getCell(String cellRef)
Gets the cell represented by given reference.
|
Column |
getColumn(int colIndex)
Gets column of this sheet represented by given index.
|
Column |
getColumn(String colRef)
Gets column of this sheet represented by given reference.
|
SpreadsheetDocument |
getDocument()
Gets parent Spreadsheet document.
|
int |
getFirstColumnIndex()
Gets index of the first defined column on the sheet.
|
int |
getFirstRowIndex()
Gets index of the first defined row on the sheet.
|
com.google.api.services.sheets.v4.model.Sheet |
getGSheet()
Returns underlay Google API object representing this sheet.
|
int |
getId()
Gets unique identifier of this sheet.
|
int |
getIndex()
Gets index of this sheet within parent Spreadsheet document.
|
int |
getLastColumnIndex()
Gets index of the last defined column contained on the sheet.
|
int |
getLastRowIndex()
Gets index of the last row contained on the sheet.
|
List<CellRange> |
getMergedRegions()
Gets list of all existing merged regions on this sheet.
|
String |
getName()
Gets the name of this sheet.
|
List<List<Object>> |
getRange(int startRow,
int startCol,
int endRow,
int endCol)
Gets values of cells range on this sheet.
|
<T> List<List<T>> |
getRange(int startRow,
int startCol,
int endRow,
int endCol,
Class<T> valueType)
Gets values of cells range on this sheet and converts them to the type specified by
valueType. |
List<List<Object>> |
getRange(String startRef,
String endRef)
Gets values of cells range on this sheet.
|
<T> List<List<T>> |
getRange(String startRef,
String endRef,
Class<T> valueType)
Gets values of cells range on this sheet and converts them to the type specified by
valueType. |
Row |
getRow(int rowIndex)
Gets the row represented with given index.
|
Row |
getRow(String rowRef)
Gets the row represented by given reference.
|
<T> Table<T> |
getTable(int headerTopRow,
int headerLeftCol,
Class<T> recordType)
Gets table located at this sheet.
|
<T> Table<T> |
getTable(int headerTopRow,
int headerLeftCol,
int headerBottomRow,
int headerRightCol,
Class<T> recordType)
Gets table located at this sheet.
|
<T> Table<T> |
getTable(String topLeftCellRef,
Class<T> recordType)
Gets table located at this sheet.
|
<T> Table<T> |
getTable(String headerTopLeftCellRef,
String headerBottomRightCellRef,
Class<T> recordType)
Gets table located at this sheet.
|
Object |
getValue(int rowIndex,
int colIndex)
Gets the value of this sheet cell by given row and column indexes.
|
<T> T |
getValue(int rowIndex,
int colIndex,
Class<T> valueType)
Gets the value of this sheet cell by given row and column indexes.
|
Object |
getValue(String cellRef)
Gets the value of this sheet cell by given cell reference.
|
<T> T |
getValue(String cellRef,
Class<T> valueType)
Gets the value of this sheet cell by given cell reference and converts it to the type
specified by
valueType. |
List<List<Object>> |
getValues()
Gets values of all cells on the sheet.
|
void |
insertColumn(InsertMethod method,
int columnPos,
int startRow,
List<?> values)
Inserts one column into this sheet at given position and sets given values to it's cells starting from
row defined by
startRow |
void |
insertColumn(InsertMethod method,
String columnRef,
String startRowRef,
List<?> values)
Inserts one column into this sheet at given position and sets given values to it's cells starting from
row defined by
startRowRef |
void |
insertRows(InsertMethod method,
int rowPos,
int startCol,
List<?> values)
Inserts rows into this sheet at given position and sets given values to their cells.
|
void |
insertRows(InsertMethod method,
String startCellRef,
List<?> values)
Inserts rows into this sheet at given position and sets given values to their cells.
|
<T> Table<T> |
insertTable(int startRow,
int startCol,
List<T> records)
Inserts table into this sheet at position starting from cell defined by
startRow and startCol (top-left cell of the table) |
<T> Table<T> |
insertTable(List<T> records)
Inserts table into this sheet at position starting from cell "A1" (0 - row index and 0 - column index)
|
<T> Table<T> |
insertTable(String topLeftCellRef,
List<T> records)
Inserts table into this sheet at position starting from cell defined by
topLeftCellRef (top-left cell of the table) |
Iterator<Row> |
iterator()
Returns an iterator of objects representing existing rows on this sheet.
|
Cell |
mergeCells(CellRange region)
Merges given cells range of this sheet.
|
Cell |
mergeCells(int startRow,
int startCol,
int endRow,
int endCol)
Merges cells range of this sheet.
|
Cell |
mergeCells(String regionRef)
Merges cells range of this sheet by given reference.
|
Cell |
mergeCells(String startCellRef,
String endCellRef)
Merges cells range of this sheet.
|
void |
moveColumn(int columnToMoveIndex,
InsertMethod method,
int toPositionIndex)
Moves column to given position within this sheet.
|
void |
moveColumn(int columnToMoveIndex,
InsertMethod method,
String toPositionRef)
Moves column to given position within this sheet.
|
void |
moveColumn(String columnToMoveRef,
InsertMethod method,
int toPositionIndex)
Moves column to given position within this sheet.
|
void |
moveColumn(String columnToMoveRef,
InsertMethod method,
String toPositionRef)
Moves column to given position within this sheet.
|
void |
moveTo(int newPos)
Moves this sheet to a new position.
|
void |
putRange(int startRow,
int startCol,
List<?> values)
Sets given values to cells range of this sheet which starts from cell (top-left) defined by
startRow
and startCol. |
void |
putRange(String startRef,
List<?> values)
Sets given values to cells range of this sheet which starts from cell (top-left) defined by
startRef. |
void |
removeColumn(Column column)
Removes a column from this sheet and shifts all followed columns to one position left.
|
void |
removeColumn(int colIndex)
Removes a column from this sheet and shifts all followed columns to one position left.
|
void |
removeColumn(String colRef)
Removes a column from this sheet and shifts all followed columns to one position left.
|
void |
removeRow(int rowIndex)
Removes a row from this sheet and shifts all rows below to one position up.
|
void |
removeRow(Row row)
Removes a row from this sheet and shifts all rows below to one position up.
|
void |
removeRow(String rowRef)
Removes a row from this sheet and shifts all rows below to one position up.
|
void |
rename(String newName)
Changes the name of this sheet.
|
void |
setColumnWidth(int columnIndex,
int width)
Sets the width of column in pixels.
|
void |
setColumnWidth(String colRef,
int width)
Sets the width of column in pixels.
|
void |
setValue(int rowIndex,
int colIndex,
Object value)
Sets the value of the sheet cell by given row and column indexes.
|
void |
setValue(String cellRef,
Object value)
Sets the value of the sheet cell by given cell reference.
|
void |
setValues(List<?> values)
Sets given values to cells range of this sheet which starts from cell "A1" (0 - row index and 0 - column index).
|
void |
unmergeCells(CellRange range)
Unmerges all merged regions on this sheet that intersects with given cells range.
|
void |
unmergeCells(int startRow,
int startCol,
int endRow,
int endCol)
Unmerges all merged regions on this sheet that intersects with given cells range.
|
void |
unmergeCells(String rangeRef)
Unmerges all merged regions on this sheet that intersects with given cells range.
|
void |
unmergeCells(String startCellRef,
String endCellRef)
Unmerges all merged regions on this sheet that intersects with given cells range.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic Sheet(SpreadsheetDocument parent, int sheetIndex)
parent - reference to parent Spreadsheet document.sheetIndex - index of the sheet within parent Spreadsheet document.public SpreadsheetDocument getDocument()
public int getIndex()
public String getName()
public int getId()
public Cell getCell(String cellRef)
cellRef - reference to necessary cell. E.g. "A23".null if cell is not defined.public Cell getCell(int rowIndex, int colIndex)
rowIndex - 0-based row index of necessary cell.colIndex - 0-based column index of necessary cell.null if cell is not defined.public Cell findCell(String value)
value - the value to lookup. Exact matching is used during comparing.null if nothing is found.public Cell findCell(MatchMethod matchMethod, String value)
matchMethod - the way how the given value will be matched with value of cell.value - the value to lookup.null if nothing is found.MatchMethodpublic Object getValue(String cellRef)
cellRef - reference string to necessary cell. E.g. "A23".null if nothing is found. The actual class of value
is depend on cell type. Can be returned Double, Boolean, LocalDateTime or String.public <T> T getValue(String cellRef, Class<T> valueType)
valueType.
If valueType is String.class, Byte.class, Short.class,
Integer.class, Long.class, Float.class or Double.class
this method performs automatic conversion of cell value to corresponding type or return null if
the conversion fails.
For other types it performs simple type casting of cell value to T or throws ClassCastException
if such type casting is not possible.
T - type of return value. Defined by value of valueType.cellRef - reference string to necessary cell. E.g. "A23".valueType - class instance of return value.null if nothing is found. The class of return
value is defined by valueType. If the actual class of cell value is different from
valueType the automatic conversion will be applied.ClassCastException - if T is different from String or Number and the value of cell cannot be
cast to T.public Object getValue(int rowIndex, int colIndex)
rowIndex - 0-based row index of necessary cell.colIndex - 0-based column index of necessary cell.null if nothing is found. The actual class of value
is depend on cell type. Can be returned Double, Boolean, LocalDateTime or String.public <T> T getValue(int rowIndex,
int colIndex,
Class<T> valueType)
valueType.
If valueType is String.class, Byte.class, Short.class,
Integer.class, Long.class, Float.class or Double.class
this method performs automatic conversion of cell value to corresponding type or return null if
the conversion fails.
For other types it performs simple type casting of cell value to T or throws ClassCastException
if such type casting is not possible.
T - type of return value. Defined by value of valueType.rowIndex - 0-based row index of necessary cell.colIndex - 0-based column index of necessary cell.valueType - class instance of return value.null if nothing is found. The class of return
value is defined by valueType. If the actual class of cell value is different from
valueType the automatic conversion will be applied.ClassCastException - if T is different from String or Number and the value of cell cannot be
cast to T.public void setValue(String cellRef, Object value)
cellRef - reference string to necessary cell. E.g. "A23".value - the value to set.public void setValue(int rowIndex,
int colIndex,
Object value)
rowIndex - 0-based row index of necessary cell.colIndex - 0-based column index of necessary cell.value - the value to set.public List<List<Object>> getValues()
Double, Boolean, LocalDateTime or String.getRange(int, int, int, int),
getFirstRowIndex(),
getFirstColumnIndex(),
getLastRowIndex(),
getLastColumnIndex()public void setValues(List<?> values)
It's an equivalent to putRange(0, 0, values).
values - list of values to set. Can be simple list of values or list of value lists. Simple list of values
is an equivalent to list with one list of values.putRange(int, int, List)public List<List<Object>> getRange(String startRef, String endRef)
startRef - reference string to top-left cell of the range. E.g. "A23".endRef - reference string to bottom-right cell of the range. E.g. "D50".Double, Boolean, LocalDateTime or String.public <T> List<List<T>> getRange(String startRef, String endRef, Class<T> valueType)
valueType.
The range is defined by given top-left and bottom-right cell references.
If valueType is String.class, Byte.class, Short.class,
Integer.class, Long.class, Float.class or Double.class
this method performs automatic conversion of cell values to corresponding type or null if the conversion
fails.
For other types it performs simple type casting of cell values to T or throws ClassCastException
if such type casting is not possible.
T - type of return cell values. Defined by value of valueType.startRef - reference string to top-left cell of the range. E.g. "A23".endRef - reference string to bottom-right cell of the range. E.g. "D50".valueType - class instance of return cell values.valueType. If the actual class of cell values is different from
valueType the automatic conversion will be applied.ClassCastException - if T is different from String or Number and the value of cell cannot be
cast to T.public List<List<Object>> getRange(int startRow, int startCol, int endRow, int endCol)
startRow - 0-based index of top row of the range.startCol - 0-based index of left column of the range.endRow - 0-based index of bottom row of the range.endCol - 0-based index of right column of the range.Double, Boolean, LocalDateTime or String.public <T> List<List<T>> getRange(int startRow, int startCol, int endRow, int endCol, Class<T> valueType)
valueType.
The range is defined by given top row, left column, bottom row and right column indexes.
If valueType is String.class, Byte.class, Short.class,
Integer.class, Long.class, Float.class or Double.class
this method performs automatic conversion of cell values to corresponding type or null if the conversion
fails.
For other types it performs simple type casting of cell values to T or throws ClassCastException
if such type casting is not possible.
T - type of return cell values. Defined by value of valueType.startRow - 0-based index of top row of the range.startCol - 0-based index of left column of the range.endRow - 0-based index of bottom row of the range.endCol - 0-based index of right column of the range.valueType - class instance of return cell values.valueType. If the actual class of cell values is different from
valueType the automatic conversion will be applied.ClassCastException - if T is different from String or Number and the value of cell cannot be
cast to T.public void putRange(String startRef, List<?> values)
startRef.
The end (bottom-right) cell of the range is defined by sizes of given values.
startRef - reference string to top-left cell of the range. E.g. "A23".values - list of values to set. Can be simple list of values or list of value lists. Simple list of values
is an equivalent to list with one list of values.public void putRange(int startRow,
int startCol,
List<?> values)
startRow
and startCol.
The end (bottom-right) cell of the range is defined by sizes of given values.
startRow - 0-based index of top row of the range.startCol - 0-based index of left column of the range.values - list of values to set. Can be simple list of values or list of value lists. Simple list of values
is an equivalent to list with one list of values.public Cell mergeCells(String regionRef)
NOTICE: If range intersects with an existing merged regions on this sheet all these regions will be unmerged at first.
regionRef - reference string to cells range that needs to be merged. E.g. "A23:D50".public Cell mergeCells(CellRange region)
NOTICE: If range intersects with an existing merged regions on this sheet all these regions will be unmerged at first.
region - CellRange that needs to be merged.public Cell mergeCells(String startCellRef, String endCellRef)
NOTICE: If range intersects with an existing merged regions on this sheet all these regions will be unmerged at first.
startCellRef - reference string to top-left cell of the range. E.g. "A23".endCellRef - reference string to bottom-right cell of the range. E.g. "D50".public Cell mergeCells(int startRow, int startCol, int endRow, int endCol)
NOTICE: If range intersects with an existing merged regions on this sheet all these regions will be unmerged at first.
startRow - 0-based index of top row of the range.startCol - 0-based index of left column of the range.endRow - 0-based index of bottom row of the range.endCol - 0-based index of right column of the range.public void unmergeCells(String rangeRef)
rangeRef - reference string to cells range. E.g. "A23:D50".public void unmergeCells(CellRange range)
range - cells range.CellRangepublic void unmergeCells(String startCellRef, String endCellRef)
startCellRef - reference string to top-left cell of the range. E.g. "A23".endCellRef - reference string to bottom-right cell of the range. E.g. "D50".public void unmergeCells(int startRow,
int startCol,
int endRow,
int endCol)
startRow - 0-based index of top row of the range.startCol - 0-based index of left column of the range.endRow - 0-based index of bottom row of the range.endCol - 0-based index of right column of the range.public List<CellRange> getMergedRegions()
public Row getRow(String rowRef)
rowRef - reference to cell that belongs to necessary row. E.g. "A23" defines row with index 22.null if row is not defined.public Row getRow(int rowIndex)
rowIndex - 0-based index of necessary row.null if row is not defined.public Row findRow(String... values)
Searches row on the sheet with given values in cells.
Each specified value should correspond to some cell value on the row. To find necessary row it looks up cells with value that matches given values. Row is found if if has cells match to all given values.
E.g. for given values ["Value1","Value2","Value3"] this method should return first row that has cell
with value "Value1", cell with value "Value2" and cell with value "Value3".
values - the set of values to lookup. Exact matching is used during comparing.null if nothing is found.public Row findRow(MatchMethod matchMethod, String... values)
Searches row on the sheet with given values in cells.
Each specified value should correspond to some cell value on the row. To find necessary row it looks up cells with value that matches given values. Row is found if if has cells match to all given values.
E.g. for MatchMethod.EXACT and given values ["Value1","Value2","Value3"] this method
should return first row that has cell with value "Value1", cell with value "Value2" and cell with value "Value3".
matchMethod - the way how the given values will be matched with value of cells. If matchMethod
is null the MatchMethod.EXACT is used as default.values - the set of values to lookup.null if nothing is found.MatchMethodpublic Row createRow(int rowIndex)
rowIndex - 0-based row index where row should be created.public void insertRows(InsertMethod method, String startCellRef, List<?> values)
Inserts rows into this sheet at given position and sets given values to their cells.
Rows can be inserted InsertMethod.BEFORE or InsertMethod.AFTER of row specified by
startCellRef.
Amount of row to insert is defined by size of given values.
method - defines position for insertion relatively to row specified by startCellRef.startCellRef - defines a row as position for insertion and top-left cell of inserted range where
values should be set.values - list of values to set. Can be simple list of values or list of value lists. Simple
list of values is an equivalent to list with one list of values. The size of first
level list defines how many rows should be inserted.public void insertRows(InsertMethod method, int rowPos, int startCol, List<?> values)
Inserts rows into this sheet at given position and sets given values to their cells.
Rows can be inserted InsertMethod.BEFORE or InsertMethod.AFTER of row specified by
rowPos.
Amount of row to insert is defined by size of given values.
method - defines position for insertion relatively to row specified by rowPos.rowPos - 0-based index of row that defines position for insertion.startCol - 0-based index of column that defines top-left cell of inserted range where
values should be set.values - list of values to set. Can be simple list of values or list of value lists. Simple
list of values is an equivalent to list with one list of values. The size of first
level list defines how many rows should be inserted.public void removeRow(String rowRef)
rowRef - reference to cell that belongs to row to remove. E.g. "A23" defines row with index 22.public void removeRow(Row row)
row - representing a row to remove.public void removeRow(int rowIndex)
rowIndex - 0-based index of row to remove.public void cleanRow(String rowRef)
rowRef - reference to cell that belongs to target row. E.g. "A23" defines row with index 22.public void cleanRow(Row row)
row - representing a target row.public void cleanRow(int rowIndex)
rowIndex - 0-based index of target row.public int getFirstRowIndex()
-1 if no rows exist.public int getLastRowIndex()
-1 if no rows exist.public Column getColumn(String colRef)
colRef - reference to cell that belongs to necessary column. E.g. "C23" defines column with index 2.null if column is not defined.public Column getColumn(int colIndex)
colIndex - 0-based index of necessary column.null if column is not defined.public void addColumn(List<?> values)
values - list of values to set.public void addColumn(String startRowRef, List<?> values)
startRowRef.startRowRef - defines top row on the column starting from which values should be set.
E.g. "A23" defines row with index 22.values - list of values to set.public void addColumn(int startRow,
List<?> values)
startRow.startRow - 0-based index of row on the column starting from which values should be set.values - list of values to set.public void insertColumn(InsertMethod method, String columnRef, String startRowRef, List<?> values)
Inserts one column into this sheet at given position and sets given values to it's cells starting from
row defined by startRowRef
Column can be inserted InsertMethod.BEFORE or InsertMethod.AFTER of column specified by
columnRef.
method - defines position for insertion relatively to column specified by columnRef.columnRef - defines a column as position for insertion. E.g. "C23" defines column with index 2.startRowRef - defines top row on the column starting from which values should be set.
E.g. "A23" defines row with index 22.values - list of values to set.public void insertColumn(InsertMethod method, int columnPos, int startRow, List<?> values)
Inserts one column into this sheet at given position and sets given values to it's cells starting from
row defined by startRow
Column can be inserted InsertMethod.BEFORE or InsertMethod.AFTER of column specified by
columnPos.
method - defines position for insertion relatively to column specified by columnPos.columnPos - 0-based index of column that defines position for insertion.startRow - 0-based index of row on the column starting from which values should be set.values - list of values to set.public void moveColumn(String columnToMoveRef, InsertMethod method, String toPositionRef)
Moves column to given position within this sheet.
Column can be moved InsertMethod.BEFORE or InsertMethod.AFTER of column specified by
toPositionRef.
columnToMoveRef - reference to cell that belongs to column to move. E.g. "C23" defines column with index 2.method - defines position for moving relatively to column specified by toPositionRef.toPositionRef - defines a column as position for moving. E.g. "C23" defines column with index 2.public void moveColumn(String columnToMoveRef, InsertMethod method, int toPositionIndex)
Moves column to given position within this sheet.
Column can be moved InsertMethod.BEFORE or InsertMethod.AFTER of column specified by
toPositionIndex.
columnToMoveRef - reference to cell that belongs to column to move. E.g. "C23" defines column with index 2.method - defines position for moving relatively to column specified by toPositionIndex.toPositionIndex - 0-based index of column that defines position for moving.public void moveColumn(int columnToMoveIndex,
InsertMethod method,
String toPositionRef)
Moves column to given position within this sheet.
Column can be moved InsertMethod.BEFORE or InsertMethod.AFTER of column specified by
toPositionRef.
columnToMoveIndex - 0-based index of column to move.method - defines position for moving relatively to column specified by toPositionRef.toPositionRef - defines a column as position for moving. E.g. "C23" defines column with index 2.public void moveColumn(int columnToMoveIndex,
InsertMethod method,
int toPositionIndex)
Moves column to given position within this sheet.
Column can be moved InsertMethod.BEFORE or InsertMethod.AFTER of column specified by
toPositionIndex.
columnToMoveIndex - 0-based index of column to move.method - defines position for moving relatively to column specified by toPositionIndex.toPositionIndex - 0-based index of column that defines position for moving.public void removeColumn(String colRef)
colRef - reference to cell that belongs to column to remove. E.g. "C23" defines column with index 2.public void removeColumn(Column column)
column - representing a column to remove.public void removeColumn(int colIndex)
colIndex - 0-based index of column to remove.public void cleanColumn(String colRef)
colRef - reference to cell that belongs to target column. E.g. "C23" defines column with index 2.public void cleanColumn(Column column)
column - representing target column.public void cleanColumn(int colIndex)
colIndex - 0-based index of target column.public void setColumnWidth(String colRef, int width)
colRef - reference to cell that belongs to target column. E.g. "C23" defines column with index 2.width - the width in pixels.public void setColumnWidth(int columnIndex,
int width)
columnIndex - 0-based index of target column.width - the width in pixels.public int getFirstColumnIndex()
-1 if no columns exist.public int getLastColumnIndex()
-1 if no columns exist.public <T> Table<T> getTable(String topLeftCellRef, Class<T> recordType)
T - class type of records that this table works with. Defined by value of
recordType.topLeftCellRef - reference string to the top-left cell of table header. E.g. "A23".recordType - class instance of records that this table works with.public <T> Table<T> getTable(int headerTopRow, int headerLeftCol, Class<T> recordType)
T - class type of records that this table works with. Defined by value of
recordType.headerTopRow - 0-based index of table header top row.headerLeftCol - 0-based index of table left column.recordType - class instance of records that this table works with.public <T> Table<T> getTable(String headerTopLeftCellRef, String headerBottomRightCellRef, Class<T> recordType)
T - class type of records that this table works with. Defined by value of
recordType.headerTopLeftCellRef - reference string to the top-left cell of table header. E.g. "A23".headerBottomRightCellRef - reference string to the bottom-right cell of table header. E.g. "A23".recordType - class instance of records that this table works with.public <T> Table<T> getTable(int headerTopRow, int headerLeftCol, int headerBottomRow, int headerRightCol, Class<T> recordType)
T - class type of records that this table works with. Defined by value of
recordType.headerTopRow - 0-based index of table header top row.headerLeftCol - 0-based index of table left column.headerBottomRow - 0-based index of table header bottom row.headerRightCol - 0-based index of table right column.recordType - class instance of records that this table works with.public <T> Table<T> findTable(Class<T> recordType, String... keywords)
recordType - class instance of records that this table works with.keywords - - keywords to localize table header. Exact matching is used during comparing keywords with
table column names.null if nothing was found.findRow(MatchMethod, String...)public <T> Table<T> findTable(Class<T> recordType, MatchMethod matchMethod, String... keywords)
recordType - class instance of records that this table works with.matchMethod - the way how given keywords will be matched with table column names. If matchMethod
is null the MatchMethod.EXACT is used as default.keywords - keywords to localize table headernull if nothing was found.findRow(MatchMethod, String...)public <T> Table<T> insertTable(List<T> records)
Table header specification and cell styles that determine how the table will looks like should be specified using annotations in the class of record. Otherwise nothing will be inserted.
T - class of records. This class should specify the table header specification and cell styles
using annotations GSheetColumn.records - list of records to be inserted as table content.GSheetColumn,
GSheetTablepublic <T> Table<T> insertTable(String topLeftCellRef, List<T> records)
topLeftCellRef (top-left cell of the table)
Table header specification and cell styles that determine how the table will looks like should be specified using annotations in the class of record. Otherwise nothing will be inserted.
T - class of records. This class should specify the table header specification and cell styles
using annotations GSheetColumn.topLeftCellRef - reference to cell that defines top-left cell of the table (place where table
should be inserted). E.g. "A23".records - list of records to be inserted as table content.GSheetColumn,
GSheetTablepublic <T> Table<T> insertTable(int startRow, int startCol, List<T> records)
startRow and startCol (top-left cell of the table)
Table header specification and cell styles that determine how the table will looks like should be specified using annotations in the class of record. Otherwise nothing will be inserted.
T - class of records. This class should specify the table header specification and cell styles
using annotations GSheetColumn.startRow - 0-based index of row that defines top-left cell of the table (place where table should be
inserted).startCol - 0-based index of column that defines top-left cell of the table (place where table should be
inserted).records - list of records to be inserted as table content.GSheetColumn,
GSheetTablepublic void moveTo(int newPos)
newPos - 0-based index where this sheet should be moved.public void rename(String newName)
newName - a new name of this sheet.public Sheet cloneAs(String clonedSheetName)
clonedSheetName - the name that should be set for cloned sheet.public Sheet copyTo(SpreadsheetDocument destDoc)
destDoc - object representing destination Spreadsheet document.public Iterator<Row> iterator()
Returns an iterator of objects representing existing rows on this sheet. Meaning it won't iterate over undefined rows.
This method allows using of this sheet object in "for" loop:
for(Row row: sheet){
int rowIndex = row.getIndex();
...
}
public com.google.api.services.sheets.v4.model.Sheet getGSheet()
Copyright © 2022. All rights reserved.