public class GridWorksheet extends Control
| Modifier and Type | Method and Description |
|---|---|
void |
addAutoFilter(int row,
int startColumn,
int endColumn)
Sets the range to which the specified AutoFilter applies.
|
void |
addCustomFilter(int row,
java.lang.String critira)
Add custom filter for the specified row.
|
void |
autoFitColumn(int columnIndex)
Autofits the column width.
|
void |
autoFitColumn(int columnIndex,
int firstRow,
int lastRow)
Autofits the column width.
|
void |
autoFitColumns() |
void |
autoFitRow(int rowIndex)
Autofits the row height.
|
void |
autoFitRow(int rowIndex,
int firstColumn,
int lastColumn)
Autofits the row height.
|
void |
autoFitRow(int startRow,
int endRow,
int startColumn,
int endColumn)
Autofits row height in a rectangle range.
|
void |
autoFitRows()
Autofits all rows in this worksheet.
|
void |
autoFitRows(boolean onlyAuto)
Autofits all rows in this worksheet.
|
void |
autoFitRows(int startRow,
int endRow)
Autofits row height in a range.
|
java.lang.Object |
calculateFormula(java.lang.String formula)
Calculates a formula.
|
void |
clearComments()
Clears all comments in designer spreadsheet.
|
void |
copy(GridWorksheet sourceSheet)
Copies contents and formats from another worksheet.
|
void |
createSubtotal(int columnNameRowIndex,
int dataRows,
int groupByColumnIndex,
int subtotalFunction,
int[] subtotalColumnIndexList)
Creates subtotal in the sheet.
|
void |
createSubtotal(int columnNameRowIndex,
int dataRows,
int groupByColumnIndex,
int subtotalFunction,
int[] subtotalColumnIndexList,
java.lang.String functionLabel,
GridTableItemStyle grandCellStyle,
GridTableItemStyle subtotalCellStyle,
int numberType,
java.lang.String customString)
Creates subtotal in the sheet.
|
void |
filterString(int column,
java.lang.String criteria)
Sets the filter for the column.notice we shall call AddAutoFilter before calling of filterString
The filter criteria string.
|
void |
freezePanes(int row,
int column,
int freezedRows,
int freezedColumns)
Freezes panes at the specified cell in the worksheet.
|
void |
freezePanes(java.lang.String cellName,
int freezedRows,
int freezedColumns)
Freezes panes at the specified cell in the worksheet.
|
java.lang.String |
getActiveCell()
Gets the active cell in the worksheet.
|
byte[] |
getBackgroundImage()
Gets worksheet background image.
|
GridCells |
getCells()
Gets the
GridCell collection. |
java.lang.String |
getCodeName()
Represents worksheet code name.
|
java.lang.String |
getColumnCaption(int column)
Gets the column caption.
|
java.lang.String |
getColumnHeaderToolTip(int colIndex)
Gets the columnheader's tooltip text.
|
boolean |
getColumnReadonly(int columnIndex)
Gets if a column is readonly.
|
GridCommentCollection |
getComments()
Gets the
GridComment collection. |
boolean |
getDisplayRightToLeft()
Indicates if the specified worksheet is displayed from right to left instead of from left to right.
|
boolean |
getDisplayZeros()
True if zero values are displayed.
|
int |
getFirstVisibleColumn()
Represents first visible column index.
|
int |
getFirstVisibleRow()
Represents first visible row index.
|
int[] |
getFreezedPanes()
Gets the freeze panes.
|
GridCell |
getGridActiveCell()
Gets the active cell in the worksheet.
|
GridHyperlinkCollection |
getHyperlinks()
Gets the
GridHyperlinkCollection collection. |
int |
getIndex()
Gets the index of sheet in the worksheet collection.
|
boolean |
getIsReadonly(int row,
int col)
Gets whether the cell is readonly.this is an extended attribute of GridWeb ,it will not keep in actual excel file
|
java.lang.String |
getName()
Gets the name of the worksheet.
|
boolean |
getOutlineShown()
Indicates whether show outline.
|
GridPictureCollection |
getPictures()
Gets a
getPictures() collection. |
GridPivotTableCollection |
getPivotTables()
Gets the pivotTables in the worksheet.
|
java.lang.String |
getRowCaption(int row)
Gets the row caption.
|
java.lang.String |
getRowHeaderToolTip(int rowIndex)
Gets the rowheader's tooltip text.
|
boolean |
getRowReadonly(int rowIndex)
Gets if a row is readonly.
|
boolean |
getSelected()
Indicates whether this worksheet is selected when the workbook is opened.
|
GridShapeCollection |
getShapes()
Gets a
getPictures() collection. |
double |
getStandardHeight()
Gets the default row height in this worksheet,in unit of points.
|
int |
getStandardHeightPixels()
Gets the default row height in this worksheet,in unit of pixels.
|
Color |
getTabColor()
Represents worksheet tab color.
|
GridValidationCollection |
getValidations()
Gets the data validation setting collection in the worksheet.
|
boolean |
getVisible()
Indicates whether this sheet's name is shown in the sheet tabs of the control.
|
GridWorkbook |
getWorkbook()
Gets the
GridWorkbook object of the worksheet collection. |
int |
getZoom()
Represents the scaling factor in percentage.
|
void |
groupRows(int firstIndex,
int lastIndex,
boolean isHidden)
Groups rows.
|
boolean |
isGridlinesVisible()
Gets a value indicating whether the grid lines are visible.Default is true.
|
boolean |
isProtected()
Indicates if the worksheet is protected.
|
boolean |
isSummaryRowBelow()
Indicates if the summary row will be positioned below the detail rows in the outline.
|
void |
moveTo(int index)
Moves the sheet to another location in the spreadsheet.
|
void |
refreshFilter()
Refresh auto filters to hide or unhide the rows.
|
void |
removeAutoFilter()
Remove the auto filter of the worksheet.
|
void |
removeSubtotal()
Removes subtotal created by the CreateSubtotal method in the sheet.
|
void |
resetFilter(int fieldIndex)
The integer offset of the field on which you want to apply ,based on the first filter column
(from the left of the list; the leftmost field is field 0).
|
void |
setActiveCell(java.lang.String value)
Sets the active cell in the worksheet.
|
void |
setAllCellsEditable()
Makes all cells editable.this is extended attribute
|
void |
setAllCellsReadonly()
Makes all cells readonly.this is extended attribute
notice this attribute can not keep in actual cell,if you want to keep protect please use setProtect
|
void |
setBackgroundImage(byte[] value)
Sets worksheet background image.
|
void |
setColumnCaption(int column,
java.lang.String caption)
Sets the caption for the column.please note this is an extension attribute and can not keep in excel file
|
void |
setColumnHeaderToolTip(int colIndex,
java.lang.String toolTip)
Sets the columnheader's tooltip text.
|
void |
setColumnReadonly(int columnIndex,
boolean isReadonly)
Sets a column to readonly so user can't delete it from client side.
|
void |
setDisplayRightToLeft(boolean value)
Indicates if the specified worksheet is displayed from right to left instead of from left to right.
|
void |
setDisplayZeros(boolean value)
True if zero values are displayed.
|
void |
setEditableRange(int startRow,
int startColumn,
int rows,
int columns)
Makes a range of cells editable.
|
void |
setFirstVisibleColumn(int value)
Represents first visible column index.
|
void |
setFirstVisibleRow(int value)
Represents first visible row index.
|
void |
setGridActiveCell(GridCell value)
Sets the active cell in the worksheet.
|
void |
setGridlinesVisible(boolean value)
Sets a value indicating whether the grid lines are visible.Default is true.
|
void |
setIsReadonly(int row,
int col,
boolean value)
Sets whether the cell is readonly.this is an extended attribute of GridWeb ,it will not keep in actual excel file
|
void |
setName(java.lang.String value)
Sets the name of the worksheet.
|
void |
setOutlineShown(boolean value)
Indicates whether show outline.
|
void |
setProtect()
Protects worksheet.
|
void |
setReadonlyRange(int startRow,
int startColumn,
int rows,
int columns)
Makes a range of cells readonly.
|
void |
setRowCaption(int row,
java.lang.String caption)
Sets the caption for the row.
|
void |
setRowHeaderToolTip(int rowIndex,
java.lang.String toolTip)
Sets the rowheader's tooltip text.
|
void |
setRowReadonly(int rowIndex,
boolean isReadonly)
Sets a row to readonly so user can't delete it from client side.
|
void |
setSelected(boolean value)
Indicates whether this worksheet is selected when the workbook is opened.
|
void |
setStandardHeight(double value)
Sets the default row height in this worksheet,in unit of points.
|
void |
setStandardHeightPixels(int value)
Sets the default row height in this worksheet,in unit of pixels.
|
void |
setSummaryRowBelow(boolean value)
Indicates if the summary row will be positioned below the detail rows in the outline.
|
void |
setTabColor(Color value)
Represents worksheet tab color.
|
void |
setVisible(boolean value)
Indicates whether this sheet's name is shown in the sheet tabs of the control.
|
void |
setZoom(int value)
Represents the scaling factor in percentage.
|
void |
unFreezePanes()
Unfreezes panes in the worksheet.
|
void |
unGroupRows(int firstIndex,
int lastIndex)
Ungroups rows.
|
void |
unProtect()
unProtects worksheet.
|
getUniqueIDpublic java.lang.String getName()
Remarks
The max length of sheet name is 31. And you cannot assign same name(case insensitive) to two worksheets. For example, you cannot set "SheetName1" to the first worksheet and set "SHEETNAME1" to the second worksheet.public void setName(java.lang.String value)
Remarks
The max length of sheet name is 31. And you cannot assign same name(case insensitive) to two worksheets. For example, you cannot set "SheetName1" to the first worksheet and set "SHEETNAME1" to the second worksheet.public void copy(GridWorksheet sourceSheet)
sourceSheet - Source worksheet.public boolean isProtected()
public int getIndex()
public GridWorkbook getWorkbook()
GridWorkbook object of the worksheet collection.public GridCommentCollection getComments()
GridComment collection.public boolean isGridlinesVisible()
public void setGridlinesVisible(boolean value)
public void unFreezePanes()
public java.lang.String getActiveCell()
public void setActiveCell(java.lang.String value)
public boolean getDisplayZeros()
public void setDisplayZeros(boolean value)
public boolean getDisplayRightToLeft()
public void setDisplayRightToLeft(boolean value)
public boolean getOutlineShown()
public void setOutlineShown(boolean value)
public boolean getSelected()
public void setSelected(boolean value)
public void freezePanes(java.lang.String cellName,
int freezedRows,
int freezedColumns)
Remarks
Row index and column index cannot all be zero. Number of rows and number of columns also cannot all be zero.cellName - Cell name.freezedRows - Number of visible rows in top pane, no more than row index.freezedColumns - Number of visible columns in left pane, no more than column index.public void freezePanes(int row,
int column,
int freezedRows,
int freezedColumns)
Remarks
Row index and column index cannot all be zero. Number of rows and number of columns also cannot all be zero.
The first two parameters specify the freezed position and the last two parameters specify the area freezed on the left top pane.
row - Row index.column - Column index.freezedRows - Number of visible rows in top pane, no more than row index.freezedColumns - Number of visible columns in left pane, no more than column index.public int[] getFreezedPanes()
public GridPictureCollection getPictures()
getPictures() collection.public GridShapeCollection getShapes()
getPictures() collection.public GridHyperlinkCollection getHyperlinks()
GridHyperlinkCollection collection.public GridValidationCollection getValidations()
public void addAutoFilter(int row,
int startColumn,
int endColumn)
row - Row index.startColumn - Start column index.endColumn - End column Index.public void filterString(int column,
java.lang.String criteria)
public void refreshFilter()
public void removeAutoFilter()
public void resetFilter(int fieldIndex)
public void addCustomFilter(int row,
java.lang.String critira)
Remarks
The filter criteria string. notice we use , and ; as split char,so the cell value shall not contains with those split char below are the criteria string examples //column 0 with value 12.3 CELL0 = 12.3 //column 1 with value ABC CELL1 = ABC //column 0 with value 123 or 456 or ABC and column 1 with value ABC CELL0 = 123,456,ABC; CELL1 = ABCpublic boolean getVisible()
getVisible in class Controlpublic void setVisible(boolean value)
setVisible in class Controlpublic void moveTo(int index)
index - Destination sheet index.public int getFirstVisibleRow()
public void setFirstVisibleRow(int value)
public int getFirstVisibleColumn()
public void setFirstVisibleColumn(int value)
public int getZoom()
public void setZoom(int value)
public Color getTabColor()
Remarks
This feature is only supported in ExcelXP(Excel2002) and above version. If you save file as Excel97 or Excel2000 format, it will be omitted.public void setTabColor(Color value)
Remarks
This feature is only supported in ExcelXP(Excel2002) and above version. If you save file as Excel97 or Excel2000 format, it will be omitted.public void clearComments()
public java.lang.String getCodeName()
Remarks
You cannot change the code name while the template file contains VBA/macro.public byte[] getBackgroundImage()
public void setBackgroundImage(byte[] value)
public java.lang.Object calculateFormula(java.lang.String formula)
formula - public void setProtect()
Remarks
This method protects worksheet without password. It can protect worksheet in all versions of Excel file.public void unProtect()
public void autoFitColumn(int columnIndex,
int firstRow,
int lastRow)
Remarks
This method autofits a row based on content in a range of cells within the row.columnIndex - Column index.firstRow - First row index.lastRow - Last row index.public void autoFitColumn(int columnIndex)
Remarks
AutoFitColumn is an imprecise function.columnIndex - Column index.public void autoFitRows()
public void autoFitColumns()
public void autoFitRow(int rowIndex,
int firstColumn,
int lastColumn)
Remarks
This method autofits a row based on content in a range of cells within the row.rowIndex - Row index.firstColumn - First column index.lastColumn - Last column index.public void autoFitRows(boolean onlyAuto)
onlyAuto - True,only autofits the row height when row height is not customed.public void autoFitRows(int startRow,
int endRow)
startRow - Start row index.endRow - End row index.public void autoFitRow(int startRow,
int endRow,
int startColumn,
int endColumn)
startRow - Start row index.endRow - End row index.startColumn - Start column index.endColumn - End column index.public void autoFitRow(int rowIndex)
Remarks
AutoFitRow is an imprecise function.rowIndex - Row index.public void setAllCellsReadonly()
public void setAllCellsEditable()
public java.lang.String getColumnCaption(int column)
column - Column index.public void setColumnCaption(int column,
java.lang.String caption)
column - Column index.caption - The column caption. Pass null or empty string if you want cancel the caption.public java.lang.String getRowCaption(int row)
row - Row index.public void setRowCaption(int row,
java.lang.String caption)
row - Row index.caption - The row caption. Pass null or empty string if you want cancel the caption.public java.lang.String getRowHeaderToolTip(int rowIndex)
rowIndex - The row's index.public void setRowHeaderToolTip(int rowIndex,
java.lang.String toolTip)
rowIndex - The row's index.toolTip - The tooltip text.public java.lang.String getColumnHeaderToolTip(int colIndex)
colIndex - The column's index.public void setColumnHeaderToolTip(int colIndex,
java.lang.String toolTip)
colIndex - The column's index.toolTip - The tooltip text.public GridPivotTableCollection getPivotTables()
public boolean getIsReadonly(int row,
int col)
public void setIsReadonly(int row,
int col,
boolean value)
public void setEditableRange(int startRow,
int startColumn,
int rows,
int columns)
startRow - The start row of the range.startColumn - The start column of the range.rows - The number of the rows.columns - The number of the columns.public void setReadonlyRange(int startRow,
int startColumn,
int rows,
int columns)
startRow - The start row of the range.startColumn - The start column of the range.rows - The number of the rows.columns - The number of the columns.public void groupRows(int firstIndex,
int lastIndex,
boolean isHidden)
firstIndex - The first row index to be grouped.lastIndex - The last row index to be grouped.isHidden - Specifies if the grouped rows are hidden.public void unGroupRows(int firstIndex,
int lastIndex)
Remarks
Only removes outter group info.firstIndex - The first row index to be ungrouped.lastIndex - The last row index to be ungrouped.public void setRowReadonly(int rowIndex,
boolean isReadonly)
rowIndex - row index.isReadonly - true or false.public void setColumnReadonly(int columnIndex,
boolean isReadonly)
columnIndex - column index.isReadonly - true or false.public boolean getRowReadonly(int rowIndex)
rowIndex - row index.public boolean getColumnReadonly(int columnIndex)
columnIndex - column index.public double getStandardHeight()
public void setStandardHeight(double value)
public int getStandardHeightPixels()
public void setStandardHeightPixels(int value)
public GridCell getGridActiveCell()
public void setGridActiveCell(GridCell value)
public boolean isSummaryRowBelow()
public void setSummaryRowBelow(boolean value)
public void createSubtotal(int columnNameRowIndex,
int dataRows,
int groupByColumnIndex,
int subtotalFunction,
int[] subtotalColumnIndexList,
java.lang.String functionLabel,
GridTableItemStyle grandCellStyle,
GridTableItemStyle subtotalCellStyle,
int numberType,
java.lang.String customString)
columnNameRowIndex - The row index of the column name row.dataRows - The number of the data rows.groupByColumnIndex - The column index of the column to be grouped.subtotalFunction - SubtotalFunction. The subtotal function type.subtotalColumnIndexList - The column indexes to be subtotaled.functionLabel - The label of subtotal function.grandCellStyle - The style of the grand total line.subtotalCellStyle - The style of the subtotal line.numberType - NumberType. The number type of the subtotal result cells.customString - The custome format string of the subtotal result cells. Can be null.public void createSubtotal(int columnNameRowIndex,
int dataRows,
int groupByColumnIndex,
int subtotalFunction,
int[] subtotalColumnIndexList)
columnNameRowIndex - The row index of the column name row.dataRows - The number of the data rows.groupByColumnIndex - The column index of the column to be grouped.subtotalFunction - SubtotalFunction. The subtotal function type.subtotalColumnIndexList - The column indexes to be subtotaled.public void removeSubtotal()
See Also:
Aspose.Cells Documentation - the home page for the Aspose.Cells Product Documentation.
Aspose.Cells Support Forum - our preferred method of support.
We guarantee a prompt response to any inquiry!
© Aspose Pty Ltd 2003-2025. All Rights Reserved.