public class Worksheet extends java.lang.Object implements IHasName, com.mindfusion.common.ISupportInitialize, INotifyPropertyValueChanged
| Modifier and Type | Field and Description |
|---|---|
static boolean |
excelStyleMergedBorders
Specifies if borders of a merged range should be drawn as in Excel, applying
the border style of each individual cell along the border, or using
border style of only the first cell in the range.
|
static boolean |
measurePaintTime |
static boolean |
styleCalcUseStreams |
| Modifier and Type | Method and Description |
|---|---|
void |
addPropertyChangedListener(java.beans.PropertyChangeListener listener)
Registers listener so that it will receive events from the worksheet.
|
void |
addWorksheetListener(WorksheetListener listener)
Registers listener so that it will receive events from the worksheet.
|
void |
applyColumnVisibility(java.util.Set<java.lang.Integer> hiddenColumns,
int maxColumn)
Apply desired column visibility in a single pass.
|
void |
applyRowVisibility(java.util.Set<java.lang.Integer> hiddenRows,
int maxRow)
Apply desired row visibility in a single pass.
|
void |
beginInit()
Signals the worksheet to enter an initialization state.
|
void |
clear()
Clears the entire content of the worksheet.
|
boolean |
copy(Workbook workbook)
Copies this worksheet to the specified workbook.
|
boolean |
copy(Workbook workbook,
int index)
Copies this worksheet to the specified workbook at the specified index.
|
boolean |
copy(Workbook workbook,
int index,
java.lang.String name)
Copies this worksheet to the specified workbook at the specified index.
|
CellData |
copyData(CellRange range)
Copies the data in the specified range and returns an object identifying the copied data.
|
StyleData |
copyStyles(CellRange range)
Copies the styles in the specified range and returns an object identifying the copied styles.
|
void |
endInit()
Signals the worksheet that initialization is complete.
|
AutoFilter |
getAutoFilter()
Gets an
AutoFilter object if autofiltering is enabled; otherwise, null. |
boolean |
getAutoFilterMode()
Gets a value indicating whether there is an active autofilter in the worksheet.
|
CellRangeCollection |
getCellRanges()
Gets an object that can be used to access and manipulate rectangular ranges of worksheet cells.
|
CellCollection |
getCells()
Gets an object that can be used to access worksheet cells by (column, row) index or by name.
|
SparseGridStorage<CellStorage> |
getCellStorage()
Gets the actual cell storage.
|
ColumnCollection |
getColumns()
Gets an object that can be used to insert, delete and modify worksheet columns.
|
Measure |
getDefaultColumnWidth()
Gets the default width of columns.
|
Measure |
getDefaultRowHeight()
Gets the default height of rows.
|
Drawing |
getDrawing()
Gets the
Drawing object associated with the worksheet. |
java.util.Locale |
getLocale()
Gets the locale of the parent workbook.
|
java.lang.Integer |
getMaxColumns()
Gets the maximum number of columns this worksheet will draw.
|
java.lang.Integer |
getMaxRows()
Gets the maximum number of rows this worksheet will draw.
|
CellRange |
getMergedCell(Cell cell)
Gets the merged cell containing the specified cell, if this cell is part of a merged cell.
|
CellRange |
getMergedCell(int column,
int row)
Gets the merged cell containing the cell with the specified coordinates, if this cell is part of a merged cell.
|
MergedCellsCollection |
getMergedCells()
Gets a list with the currently merged cells.
|
java.lang.String |
getName()
Gets the name of the worksheet.
|
RowCollection |
getRows()
Gets an object that can be used to insert, delete and modify worksheet rows.
|
Brush |
getTabBackground()
Gets the color of tab associated with this worksheet.
|
java.lang.Object |
getTag()
Gets a custom object associated with the worksheet.
|
boolean |
getVisible()
Gets a value indicating whether this worksheet is visible.
|
Workbook |
getWorkbook() |
int |
getZoom()
Gets the zoom factor of the worksheet when displayed in a view.
|
boolean |
merge(CellRange range)
Merges the cells in the specified range into a single cell.
|
boolean |
merge(CellRange range,
boolean validate) |
boolean |
merge(int topLeftColumn,
int topLeftRow,
int bottomRightColumn,
int bottomRightRow)
Merges the cells in the specified range into a single cell.
|
boolean |
merge(java.lang.String range)
Merges the cells in the specified range into a single cell.
|
boolean |
move(Workbook workbook)
Moves this worksheet to the specified workbook.
|
boolean |
move(Workbook workbook,
int index)
Moves this worksheet to the specified workbook at the specified position.
|
boolean |
move(Workbook workbook,
int index,
java.lang.String name)
Moves this worksheet to the specified workbook at the specified position.
|
protected void |
onCellChanged(CellChangedEvent e)
Raises the
cellChanged event. |
protected void |
onCellChangedPostCalc(CellChangedEvent e)
Raises the
cellChangedPostCalc event. |
protected void |
onCellChangedPreCalc(CellChangedEvent e)
Raises the
cellChangedPreCalc event. |
protected void |
onCellChanging(CellValidationEvent e)
Raises the
cellChanging event. |
protected void |
onCellParsing(CellParsingEvent e) |
protected void |
onCellsCleared(java.util.EventObject e)
Raises the
cellsCleared event. |
protected void |
onCellStyleChanging(CellValidationEvent e)
Raises the
cellChanging event. |
protected void |
onColumnChanged(ColumnChangedEvent e)
Raises the
columnChanged event. |
protected void |
onPropertyChange(java.beans.PropertyChangeEvent e)
Raises the
propertyChange event. |
protected void |
onRowChanged(RowChangedEvent e)
Raises the
rowChanged event. |
protected void |
onValidationFailed(ValidationFailedEvent e)
Raises the
validationFailed event. |
void |
pasteData(Cell cell,
CellData cellData)
Pastes the data identified by the specified object at the
specified location.
|
void |
pasteStyles(Cell cell,
StyleData styleData)
Pastes the styles identified by the specified object at the specified location.
|
void |
removePropertyChangedListener(java.beans.PropertyChangeListener listener)
Unregisters listener so that it will no longer receive worksheet events.
|
void |
removeWorksheetListener(WorksheetListener listener)
Unregisters listener so that it will no longer receive worksheet events.
|
void |
setAutoFilterMode(boolean value)
Sets a value indicating whether there is an active autofilter in the worksheet.
|
void |
setDefaultColumnWidth(Measure value)
Sets the default width of columns.
|
void |
setDefaultRowHeight(Measure value)
Sets the default height of rows.
|
void |
setMaxColumns(java.lang.Integer value)
Sets the maximum number of columns this worksheet will draw.
|
void |
setMaxRows(java.lang.Integer value)
Sets the maximum number of rows this worksheet will draw.
|
void |
setName(java.lang.String value)
Sets the name of the worksheet.
|
void |
setTabBackground(Brush value)
Sets the color of tab associated with this worksheet.
|
void |
setTag(java.lang.Object value)
Sets a custom object associated with the worksheet.
|
void |
setVisible(boolean value)
Sets a value indicating whether this worksheet is visible.
|
void |
setZoom(int value)
Sets the zoom factor of the worksheet when displayed in a view.
|
boolean |
sort(CellRange range,
SortOptions options)
Sorts the data in the specified range according to the specified criteria.
|
java.lang.String |
toString() |
TrackChangesCommand |
trackChanges()
Creates a
TrackChangesCommand object that can be used to track subsequent
changes on the creator. |
void |
unmerge(CellRange range)
Unmerges all merged cells intersecting with the specified range.
|
void |
unmerge(int topLeftColumn,
int topLeftRow,
int bottomRightColumn,
int bottomRightRow)
Unmerges all merged cells intersecting with the specified range.
|
void |
unmerge(java.lang.String range)
Unmerges all merged cells intersecting with the specified range.
|
public static boolean excelStyleMergedBorders
public static boolean styleCalcUseStreams
public static boolean measurePaintTime
public void addWorksheetListener(WorksheetListener listener)
listener - An object implementing the WorksheetListener interface.public void removeWorksheetListener(WorksheetListener listener)
listener - An object implementing the WorksheetListener interface.public void addPropertyChangedListener(java.beans.PropertyChangeListener listener)
addPropertyChangedListener in interface INotifyPropertyValueChangedlistener - An object implementing the PropertyChangeListener interface.public void removePropertyChangedListener(java.beans.PropertyChangeListener listener)
removePropertyChangedListener in interface INotifyPropertyValueChangedlistener - An object implementing the PropertyChangeListener interface.public java.lang.String toString()
toString in class java.lang.Objectpublic void beginInit()
endInit().beginInit in interface com.mindfusion.common.ISupportInitializepublic void endInit()
beginInit().endInit in interface com.mindfusion.common.ISupportInitializepublic boolean copy(Workbook workbook)
workbook - The workbook to copy to.true if the copy was successful; otherwise, false.
The method returns false if the workbook contains a worksheet with the same name.public boolean copy(Workbook workbook, int index)
workbook - The workbook to copy to.index - The 0-based index in the target workbook where to copy this worksheet,
or -1, to copy at the end of the workbook.true if the copy was successful; otherwise, false.
The method returns false if the workbook contains a worksheet with the same name.public boolean copy(Workbook workbook, int index, java.lang.String name)
workbook - The workbook to copy to.index - The 0-based index in the target workbook where to copy this worksheet,
or -1, to copy at the end of the workbook.name - The new name of copied the worksheet.true if the copy was successful; otherwise, false.
The method returns false if the workbook contains a worksheet with the same name.public boolean move(Workbook workbook)
workbook - The workbook to move to.true if the move was successful; otherwise, false.
The method returns false if the workbook contains a worksheet with the same name.public boolean move(Workbook workbook, int index)
workbook - The workbook to move to.index - The 0-based index in the target workbook where to copy this worksheet,
or -1, to copy at the end of the workbook.true if the move was successful; otherwise, false.
The method returns false if the workbook contains a worksheet with the same name.public boolean move(Workbook workbook, int index, java.lang.String name)
workbook - The workbook to move to.index - The 0-based index in the target workbook where to copy this worksheet,
or -1, to copy at the end of the workbook.name - The new name of moved the worksheet.true if the move was successful; otherwise, false.
The method returns false if the workbook contains a worksheet with the same name.public TrackChangesCommand trackChanges()
TrackChangesCommand object that can be used to track subsequent
changes on the creator. The changes are accepted when the command is committed.TrackChangesCommand object.protected void onPropertyChange(java.beans.PropertyChangeEvent e)
propertyChange event.e - An object providing the event data.protected void onCellChanging(CellValidationEvent e)
cellChanging event.e - An object providing the event data.protected void onCellParsing(CellParsingEvent e)
protected void onCellStyleChanging(CellValidationEvent e)
cellChanging event.e - An object providing the event data.protected void onCellChanged(CellChangedEvent e)
cellChanged event.e - An object providing the event data.protected void onCellChangedPreCalc(CellChangedEvent e)
cellChangedPreCalc event.e - An object providing the event data.protected void onCellChangedPostCalc(CellChangedEvent e)
cellChangedPostCalc event.e - An object providing the event data.protected void onCellsCleared(java.util.EventObject e)
cellsCleared event.e - An object providing the event data.protected void onColumnChanged(ColumnChangedEvent e)
columnChanged event.e - An object providing the event data.protected void onRowChanged(RowChangedEvent e)
rowChanged event.e - An object providing the event data.public void applyRowVisibility(java.util.Set<java.lang.Integer> hiddenRows,
int maxRow)
hiddenRows - Indices of rows to hide.maxRow - The last row to make visible.public void applyColumnVisibility(java.util.Set<java.lang.Integer> hiddenColumns,
int maxColumn)
hiddenColumns - Indices of columns to hide.maxColumn - The last column to make visible.protected void onValidationFailed(ValidationFailedEvent e)
validationFailed event.e - An object providing the event data.public void clear()
public boolean merge(CellRange range)
The merge will fail if the specified range contains only a single cell or if the range intersects with another merged cell.
range - The range that specifies the cells to merge.true if the merge was successful; otherwise, false.public boolean merge(CellRange range, boolean validate)
public boolean merge(java.lang.String range)
The merge will fail if the specified range contains only a single cell or if the range intersects with another merged cell.
range - A string specifying the range of cells to merge.true if the merge was successful; otherwise, false.public boolean merge(int topLeftColumn,
int topLeftRow,
int bottomRightColumn,
int bottomRightRow)
The merge will fail if the specified range contains only a single cell or if the range intersects with another merged cell.
topLeftColumn - The top-left column of the range of cells.topLeftRow - The top-left row of the range of cells.bottomRightColumn - The bottom-right column of the range of cells.bottomRightRow - The bottom-right row of the range of cells.true if the merge was successful; otherwise, false.public void unmerge(CellRange range)
range - A range that specifies the cells to unmerge.public void unmerge(java.lang.String range)
range - A string specifying the range of cells to unmerge.public void unmerge(int topLeftColumn,
int topLeftRow,
int bottomRightColumn,
int bottomRightRow)
topLeftColumn - The top-left column of the range of cells.topLeftRow - The top-left row of the range of cells.bottomRightColumn - The bottom-right column of the range of cells.bottomRightRow - The bottom-right row of the range of cells.public CellRange getMergedCell(Cell cell)
cell - The cell to inspect.CellRange class representing the containing merged cell,
or null, if cell is not merged.public CellRange getMergedCell(int column, int row)
column - The column of the cell to inspect.row - The row of the cell to inspect.CellRange class representing the containing merged cell,
or null, if the cell with the specified coordinates is not merged.public boolean sort(CellRange range, SortOptions options)
The sorting will fail if there are no keys specified or if all keys are outside of the current range.
range - The range to sort.options - The sort settings, such as sort keys and direction.true if the sort was successful; otherwise, false.public CellData copyData(CellRange range)
range - The range from which the data is copied.public void pasteData(Cell cell, CellData cellData)
cell - A Cell object identifying the target range. The dimensions of
the target range are identical to the dimensions of the source range.cellData - An object identifying the data to paste.public StyleData copyStyles(CellRange range)
range - The range from which the styles are copied.public void pasteStyles(Cell cell, StyleData styleData)
cell - A Cell object identifying the target range. The dimensions of
the target range are identical to the dimensions of the source range.styleData - An object identifying the styles to paste.public Workbook getWorkbook()
public java.lang.String getName()
The name of a worksheet must be unique (ignoring case) amongst all worksheets in a Workbook.
public void setName(java.lang.String value)
The name of a worksheet must be unique (ignoring case) amongst all worksheets in a Workbook.
public void setTabBackground(Brush value)
value - The com.mindfusion.drawing.Brush object used to draw the tab.public Brush getTabBackground()
public SparseGridStorage<CellStorage> getCellStorage()
public CellCollection getCells()
public CellRangeCollection getCellRanges()
public ColumnCollection getColumns()
public RowCollection getRows()
public MergedCellsCollection getMergedCells()
public java.util.Locale getLocale()
public Measure getDefaultColumnWidth()
public void setDefaultColumnWidth(Measure value)
public Measure getDefaultRowHeight()
public void setDefaultRowHeight(Measure value)
public java.lang.Integer getMaxColumns()
public void setMaxColumns(java.lang.Integer value)
value - An Integer value.public java.lang.Integer getMaxRows()
public void setMaxRows(java.lang.Integer value)
value - An Integer value.public boolean getVisible()
public void setVisible(boolean value)
public java.lang.Object getTag()
public void setTag(java.lang.Object value)
public int getZoom()
public void setZoom(int value)
public AutoFilter getAutoFilter()
AutoFilter object if autofiltering is enabled; otherwise, null.
To create an AutoFilter object for a worksheet, you must enable autofiltering for a range
on the worksheet by using the autoFilter method of the CellRange class.
public boolean getAutoFilterMode()
This property can be set to false to turn autofiltering off, but cannot be set to true.
To enable autofiltering, call the autoFilter method of the CellRange class.
public void setAutoFilterMode(boolean value)