Home  Products  Purchase  Downloads  Demos  Forums  Blogs  Ticket  Wiki  API  Corporate


com.aspose.cells
Class Worksheet

java.lang.Object
  extended by com.aspose.cells.Worksheet

public final class Worksheet
extends java.lang.Object

Represents a worksheet.


Method Summary
 void addPageBreaks(int row, int column)
          Adds a page break to the worksheet.
 void addPageBreaks(java.lang.String cellName)
          Adds a page break to the worksheet.
 void autoFitColumn(int columnIndex)
          Autofits the column width.
 void autoFitColumn(int columnIndex, int startRow, int endRow)
          Autofits the column width.
 void autoFitColumns()
          Autofits all columns width in this worksheet.
 void autoFitColumns(int startColumn, int endColumn)
          Autofits columns width from startColumn to endColumn.
 void autoFitColumns(int startRow, int startColumn, int endRow, int endColumn)
          Autofits columns width in a rectangle range.
 void autoFitRow(int rowIndex)
          Autofits the row height.
 void autoFitRow(int rowIndex, int startColumn, int endColumn)
          Autofits the row height.
 void autoFitRows()
          Autofits all rows height in this worksheet.
 void autoFitRows(int startRow, int endRow)
          Autofits rows height from startRow to endRow.
 void autoFitRows(int startRow, int startColumn, int endRow, int endColumn)
          Autofits rows height in a rectangle range.
 void calculateFormula(boolean recursive, boolean ignoreError)
          Calculates all formulas in this worksheet.
 void clearComments()
          Clears all comments in the worksheet.
 void copy(Worksheet sheet)
          Copys contents and formats from another worksheet.
 void deleteColumns(int startIndex, int deletedColumns, boolean bShift)
          Deprecated. Replaced by Cells.deleteColumns(int,int,boolean)
 void deleteRows(int startIndex, int deletedRows, boolean bShift)
          Deprecated. Replaced by Cells.deleteRows(int,int,boolean)
 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, short freezedColumns)
          Freezes panes at the specified cell in the worksheet.
 java.lang.String getActiveCell()
          Gets the active cell.
 AutoFilter getAutoFilter()
          Gets autofiltering object for the specified worksheet.
 Cell getCell(int rowIndex, int columnIndex)
          Deprecated. Replaced by Cells.getCell(int,int)
 Cell getCell(java.lang.String cellName)
          Deprecated. Replaced by Cells.getCell(String)
 Cells getCells()
          Gets a collection of Cell objects.
 Charts getCharts()
          Gets a Charts collection.
 Style getColumnStyle(int columnIndex)
          Gets the style setting for the specified column.
 float getColumnWidth(int columnIndex)
          Deprecated. Replaced by Cells.getColumnWidth(int)
 Comments getComments()
          Gets the Comments collection.
 ConditionalFormattings getConditionalFormattings()
          Gets the ConditionalFormattings in the worksheet.
 float getDefaultColumnWidth()
          Deprecated. Replaced by Cells.getStandardWidth()
 float getDefaultRowHeight()
          Deprecated. Replaced by Cells.getStandardHeight()
 int getFirstRowIndex()
          Deprecated. Replaced by Cells.getMinRow()
 short getFirstVisibleColumn()
          Gets first visible column index.
 int getFirstVisibleRow()
          Gets first visible row index.
 int[] getFrozenInfo()
          Gets info of frozen panes.
 HPageBreaks getHPageBreaks()
          Get the HPageBreaks in the worksheet.
 Hyperlinks getHyperlinks()
          Get the Hyperlinks in the worksheet.
 int getIndex()
          Gets the sheet index.
 int getLastRowIndex()
          Deprecated. Replaced by Cells.getMaxRow()
 java.util.ArrayList getMergedCells()
          Deprecated. Replaced by Cells.getMergedCells()
 java.lang.String getName()
          Returns the name of the worksheet.
 NamedRange[] getNamedRanges()
          Gets all pre-defined named ranges in the specific worksheet.
 Outline getOutline()
          Gets Outline object on a worksheet.
 PageSetup getPageSetup()
          Get the page setup options in the worksheet.
 Pictures getPictures()
          Gets a Pictures collection.
 PivotTables getPivotTables()
          Gets the PivotTables Object which Represents the collection of all the PivotTable objects in the worksheet
 Protection getProtection()
          Gets the current protection settings.
 Row getRow(int rowIndex)
          Deprecated. Replaced by Cells.getRow(int)
 java.util.Iterator getRowIterator()
          Deprecated. Replaced by Cells.getRowIterator()
 Shapes getShapes()
          Gets the Shapes object in the worksheet.
 SparklineGroupCollection getSparklineGroupCollection()
          Gets the sparkline group collection in the worksheet.
 Color getTabColor()
          Gets the colour of the tab below the sheet containing the sheet name.
 TextBoxes getTextBoxes()
          Gets the TextBoxes collection.
 short getType()
          Returns the type of the worksheet.
 Validations getValidations()
          Get the Validations in the worksheet.
 VPageBreaks getVPageBreaks()
          Get the VPageBreaks in the worksheet.
 Workbook getWorkbook()
          Gets the workbook which contains this worksheet.
 short getZoom()
          Gets the scaling factor in percent.
 void groupColumns(int startIndex, int endIndex)
          Deprecated. Replaced by Cells.groupColumns(int,int)
 void groupColumns(int startIndex, int endIndex, boolean isHidden)
          Deprecated. Replaced by Cells.groupColumns(int,int,boolean)
 void groupRows(int startIndex, int endIndex)
          Deprecated. Replaced by Cells.groupRows(int,int)
 void groupRows(int startIndex, int endIndex, boolean isHidden)
          Deprecated. Replaced by Cells.groupRows(int,int,boolean)
 boolean hasAutoFilter()
          Indicates whether the sheet has bean auto filtered.
 int importResultSet(java.sql.ResultSet rs, int rowIndex, int columnIndex, boolean isFieldNameShown)
          Deprecated. Replaced by Cells.importResultSet(ResultSet,int,int,boolean)
 int importResultSet(java.sql.ResultSet rs, int rowIndex, int columnIndex, int rowNum, int columnNum, boolean isFieldNameShown)
          Deprecated. Replaced by Cells.importResultSet(ResultSet,int,int,int,int,boolean)
 int importResultSet(java.sql.ResultSet rs, java.lang.String startCell, boolean isFieldNameShown)
          Deprecated. Replaced by Cells.importResultSet(ResultSet,String,boolean)
 int importResultSet(java.sql.ResultSet rs, java.lang.String startCell, int rowNum, int columnNum, boolean isFieldNameShown)
          Deprecated. Replaced by Cells.importResultSet(ResultSet,String,String,boolean)
 void insertColumns(int columnIndex, int columnNum)
          Deprecated. Replaced by Cells.insertColumns(int,int)
 void insertRows(int rowIndex, int rowNum)
          Deprecated. Replaced by Cells.insertRows(int,int)
 boolean isActive()
          Indicates whether the worksheet is active.
 boolean isColumnHidden(int columnIndex)
          Deprecated. Replaced by Cells.isColumnHidden(int)
 boolean isGridlinesVisible()
          Gets if the the gride lines are visible.
 boolean isPageBreakPreview()
          Indicates the specified worksheet is shown in normal view or page break preview.
 boolean isRowColumnHeadersVisible()
          Gets whether the worksheet will display row and column headers.
 boolean isSelected()
          Indicates whether the worksheet is selected.
 boolean isVeryHidden()
          Checks if the worksheet is very hidden.
 boolean isVisible()
          Gets if the worksheet is visible.
 void protect(Protection protection)
          Protects the worksheet.
 void removeCell(int rowIndex, int columnIndex)
          Deprecated. Replaced by Cells.removeCell(int,int)
 void removeCell(java.lang.String cellName)
          Deprecated. Replaced by Cells.reomveCell(String)
 void removeRow(int rowIndex)
          Deprecated. Replaced by Cells.removeRow(int)
 void removeSplit()
          Removes splitted window.
 void setActiveCell(int row, int column)
          Sets the active cell.
 void setActiveCell(java.lang.String cellName)
          Sets the active cell.
 void setBackground(byte[] pictureData)
          Sets the background for the worksheet.
 void setColumnHidden(int columnIndex, boolean isHidden)
          Deprecated. Replaced by Cells.setColumnHidden(int,boolean)
 void setColumnStyle(short columnIndex, Style style)
          Sets a style to the specified column.
 void setColumnWidth(int columnIndex, float columnWidth)
          Deprecated. Replaced by Cells.setColumnWidth(int,float)
 void setDefaultColumnWidth(float defaultColumnWidth)
          Deprecated. Replaced by Cells.setStandardWidth(float)
 void setDefaultRowHeight(float defaultRowHeight)
          Deprecated. Replaced by Cells.setStandardHeight(float)
 void setFirstVisibleColumn(int column)
          Sets first visible column index.
 void setFirstVisibleRow(int row)
          Sets first visible row index.
 void setGridlinesVisible(boolean gridlinesVisible)
          Sets whether the grid lines to be visible or not.
 void setName(java.lang.String name)
          Sets the worksheet name.
 void setPageBreakPreview(boolean pageBreakPreview)
          Sets the specified worksheet is shown in normal view or page break preview.
 void setRowColumnHeadersVisible(boolean rowColumnHeadersVisible)
          Sets whether the worksheet will display row and column headers.
 void setSelected(boolean isSelected)
          Sets whether the worksheet is selected.
 void setStyle(int startRow, int endRow, int startColumn, int endColumn, Style style)
          Deprecated. Replaced by Cells.setRangeStyle(int,int,int,int,Style)
 void setTabColor(Color tabColor)
          Sets the colour of the tab below the sheet containing the sheet name.
 void setVeryHidden(boolean veryHidden)
          Sets whether the worksheet to be very hidden or not.
 void setVisible(boolean visible)
          Sets whether the worksheet to be visible or not.
 void setZoom(int zoom)
          Sets the scaling factor in percent.
 void split()
          Splits window.
 void unFreezePanes()
          Unfreezes panes in the worksheet.
 void ungroupColumns(int startIndex, int endIndex)
          Deprecated. Replaced by Cells.ungroupColumns(int,int)
 void ungroupRows(int startIndex, int endIndex)
          Deprecated. Replaced by Cells.ungroupRows(int,int)
 void unprotect()
          Unprotects the worksheet which is protected without password.
 void unprotect(java.lang.String password)
          Unprotects the worksheet.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

copy

public void copy(Worksheet sheet)
Copys contents and formats from another worksheet.

Parameters:
sheet - Source worksheet.

getCells

public Cells getCells()
Gets a collection of Cell objects.

Returns:
a collection of Cell objects.
Throws:
CellsException - if the worksheet has been removed from the workbook.

getWorkbook

public Workbook getWorkbook()
Gets the workbook which contains this worksheet.

Returns:
the workbook.
Throws:
CellsException - if the worksheet has been removed from the workbook.

getName

public java.lang.String getName()
Returns the name of the worksheet.

Returns:
name of the worksheet

getIndex

public int getIndex()
Gets the sheet index.

Returns:
the sheet index.

getType

public short getType()
Returns the type of the worksheet. It is one of the constant fields of SheetType. Now only SheetType.Worksheet is supported.

Returns:
type of the worksheet.
See Also:
SheetType

setName

public void setName(java.lang.String name)
Sets the worksheet name.

Parameters:
name - name of the worksheet. The name length should be 1 to 31.
Throws:
java.lang.IllegalArgumentException - if name is invalid
CellsException - if the worksheet has been removed from the workbook, or a worksheet with the same name already exists.

isVisible

public boolean isVisible()
Gets if the worksheet is visible.

Returns:
true if the worksheet is visible.

setVisible

public void setVisible(boolean visible)
Sets whether the worksheet to be visible or not.

Parameters:
visible - true for visible
Throws:
CellsException - if the worksheet has been removed from the workbook.

isVeryHidden

public boolean isVeryHidden()
Checks if the worksheet is very hidden.

Returns:
true if the worksheet is visible.

setVeryHidden

public void setVeryHidden(boolean veryHidden)
Sets whether the worksheet to be very hidden or not.

Parameters:
veryHidden - true for veryHidden
Throws:
CellsException - if the worksheet has been removed from the workbook.

setSelected

public void setSelected(boolean isSelected)
Sets whether the worksheet is selected.

Parameters:
isSelected - whether the worksheet is selected.

isSelected

public boolean isSelected()
Indicates whether the worksheet is selected.

Returns:
whether the worksheet is selected.

isActive

public boolean isActive()
Indicates whether the worksheet is active.

Returns:
whether the worksheet is active.

getZoom

public short getZoom()
Gets the scaling factor in percent.


setZoom

public void setZoom(int zoom)
Sets the scaling factor in percent. It should be between 10 and 400. If you changed the sheet view mode,you should reset the scaling factor.

Parameters:
zoom - the scaling factor in percent.
Throws:
CellsException - if the worksheet has been removed from the workbook.

setActiveCell

public void setActiveCell(java.lang.String cellName)
Sets the active cell.

Parameters:
cellName - the cell name.
Throws:
java.lang.IllegalArgumentException - if cell name is invalid.

getActiveCell

public java.lang.String getActiveCell()
Gets the active cell.

Returns:
the active cell name.

setActiveCell

public void setActiveCell(int row,
                          int column)
Sets the active cell.

Parameters:
row - row index.
column - column index.
Throws:
java.lang.IllegalArgumentException - if row/column index is out of range.

getFirstVisibleRow

public int getFirstVisibleRow()
Gets first visible row index.

Returns:
first visible row index.

setFirstVisibleRow

public void setFirstVisibleRow(int row)
Sets first visible row index.

Parameters:
row - first visible row index.
Throws:
java.lang.IllegalArgumentException - if row index is out of range.
CellsException - if the worksheet has been removed from the workbook.

getFirstVisibleColumn

public short getFirstVisibleColumn()
Gets first visible column index.

Returns:
first visible column index.

setFirstVisibleColumn

public void setFirstVisibleColumn(int column)
Sets first visible column index.

Parameters:
column - first visible column index,zero besed.
Throws:
java.lang.IllegalArgumentException - if column index is out of range.
CellsException - if the worksheet has been removed from the workbook.

getTabColor

public Color getTabColor()
Gets the colour of the tab below the sheet containing the sheet name.

Returns:
the colour of the tab below the sheet containing the sheet name.

setTabColor

public void setTabColor(Color tabColor)
Sets the colour of the tab below the sheet containing the sheet name.

Parameters:
tabColor - the colour of the tab below the sheet containing the sheet name.

split

public void split()
Splits window.

Throws:
CellsException - if the worksheet has been removed from the workbook.

removeSplit

public void removeSplit()
Removes splitted window.

Throws:
CellsException - if the worksheet has been removed from the workbook.

freezePanes

public void freezePanes(int row,
                        int column,
                        int freezedRows,
                        int freezedColumns)
Freezes panes at the specified cell in the worksheet.

Parameters:
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.
Throws:
java.lang.IllegalArgumentException - if row index,column index,freezedRows or freezedColumns is out of range.
java.lang.IllegalArgumentException - if row index or column index all are zero. number of rows and number of columns all are zero.
CellsException - if the worksheet has been removed from the workbook.

freezePanes

public void freezePanes(java.lang.String cellName,
                        int freezedRows,
                        short freezedColumns)
Freezes panes at the specified cell in the worksheet.

Parameters:
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.
Throws:
java.lang.IllegalArgumentException - if cell name is invalid.
See Also:
freezePanes(int, int, int, int)

getFrozenInfo

public int[] getFrozenInfo()
Gets info of frozen panes.

Returns:
int[] info of frozen panes: [0] is the row index of the cell at which freezes panes; [1] is the column index of the cell at which freezes panes; [2] is the row count being frozen; [3] is the column count being frozen; If no frozen panes, return null.

unFreezePanes

public void unFreezePanes()
Unfreezes panes in the worksheet.

Throws:
CellsException - if the worksheet has been removed from the workbook.

isPageBreakPreview

public boolean isPageBreakPreview()
Indicates the specified worksheet is shown in normal view or page break preview.

Returns:
whether the specified worksheet is shown in normal view or page break preview.

setPageBreakPreview

public void setPageBreakPreview(boolean pageBreakPreview)
Sets the specified worksheet is shown in normal view or page break preview. If this parameter is changed ,the current scaling factor will be cached and the cached factor will replace the current scaling factor. You should reset the scaling factor which you want to set.

Parameters:
pageBreakPreview - whether the specified worksheet is shown in normal view or page break preview.
Throws:
CellsException - if the worksheet has been removed from the workbook.

isGridlinesVisible

public boolean isGridlinesVisible()
Gets if the the gride lines are visible.


setGridlinesVisible

public void setGridlinesVisible(boolean gridlinesVisible)
Sets whether the grid lines to be visible or not.

Parameters:
gridlinesVisible - whether the grid lines to be visible or not.
Throws:
CellsException - if the worksheet has been removed from the workbook.

isRowColumnHeadersVisible

public boolean isRowColumnHeadersVisible()
Gets whether the worksheet will display row and column headers.


setRowColumnHeadersVisible

public void setRowColumnHeadersVisible(boolean rowColumnHeadersVisible)
Sets whether the worksheet will display row and column headers.

Parameters:
rowColumnHeadersVisible - whether the worksheet will display row and column headers.
Throws:
CellsException - if the worksheet has been removed from the workbook.

getColumnStyle

public Style getColumnStyle(int columnIndex)
Gets the style setting for the specified column.

Parameters:
columnIndex - column index.
Returns:
style of the column.
Throws:
java.lang.IllegalArgumentException - if column index is out of range.
CellsException - if the worksheet has been removed from the workbook.

setColumnStyle

public void setColumnStyle(short columnIndex,
                           Style style)
Sets a style to the specified column.

Parameters:
columnIndex - column index.
style - style to set.
Throws:
java.lang.IllegalArgumentException - if column index is out of range.
CellsException - if the worksheet has been removed from the workbook.

getHyperlinks

public Hyperlinks getHyperlinks()
Get the Hyperlinks in the worksheet.

Returns:
Hyperlinks.You can manipulate this Hyperlinks to add Hyperlink.

getCharts

public Charts getCharts()
Gets a Charts collection.

Returns:
a Charts collection.You can manipulate this Charts to add chart

getPivotTables

public PivotTables getPivotTables()
Gets the PivotTables Object which Represents the collection of all the PivotTable objects in the worksheet

Returns:
the PivotTables Object.

getShapes

public Shapes getShapes()
Gets the Shapes object in the worksheet.

Returns:
the Shapes object.

getSparklineGroupCollection

public SparklineGroupCollection getSparklineGroupCollection()
Gets the sparkline group collection in the worksheet.

Returns:
sparkline group collection

getPictures

public Pictures getPictures()
Gets a Pictures collection.

Returns:
a Pictures collection.

getAutoFilter

public AutoFilter getAutoFilter()
Gets autofiltering object for the specified worksheet.

Returns:
autofiltering object.

hasAutoFilter

public boolean hasAutoFilter()
Indicates whether the sheet has bean auto filtered.

Returns:
whether the sheet has bean auto filtered.

getComments

public Comments getComments()
Gets the Comments collection.

Returns:
the Comments collection.

clearComments

public void clearComments()
Clears all comments in the worksheet.


getTextBoxes

public TextBoxes getTextBoxes()
Gets the TextBoxes collection.

Returns:
the TextBoxes collection.

getOutline

public Outline getOutline()
Gets Outline object on a worksheet.

Returns:
Outline object

getValidations

public Validations getValidations()
Get the Validations in the worksheet.

Returns:
Validations.You can manipulate this Validations to add validation.

getVPageBreaks

public VPageBreaks getVPageBreaks()
Get the VPageBreaks in the worksheet.

Returns:
VPageBreaks.You can manipulate this VPageBreaks to add vertical page breaks.

getHPageBreaks

public HPageBreaks getHPageBreaks()
Get the HPageBreaks in the worksheet.

Returns:
HPageBreaks.You can manipulate this HPageBreaks to add horizontal page breaks.

addPageBreaks

public void addPageBreaks(java.lang.String cellName)
Adds a page break to the worksheet.

Parameters:
cellName - cell name.
Throws:
java.lang.IllegalArgumentException - if cell name is invalid.

addPageBreaks

public void addPageBreaks(int row,
                          int column)
Adds a page break to the worksheet.

Parameters:
row - row index,zero based
column - column index,zero based.
Throws:
java.lang.IllegalArgumentException - if row index or cell indexs is invalid.

getPageSetup

public PageSetup getPageSetup()
Get the page setup options in the worksheet.

Returns:
PageSetup.You can manipulate this object to set all page setup options.

getConditionalFormattings

public ConditionalFormattings getConditionalFormattings()
Gets the ConditionalFormattings in the worksheet.

Returns:
ConditionalFormattings.You can manipulate this object to set conditional formatting.

getProtection

public Protection getProtection()
Gets the current protection settings.

Returns:
protection options. If the worksheet is not protected, null is returned.

protect

public void protect(Protection protection)
Protects the worksheet.

Parameters:
protection - protection options.

unprotect

public void unprotect()
Unprotects the worksheet which is protected without password.


unprotect

public void unprotect(java.lang.String password)
Unprotects the worksheet. If the worksheet is protected without a password, you can set a null value or blank string to password parameter.

Throws:
java.lang.IllegalArgumentException - if password is invalid.

getNamedRanges

public NamedRange[] getNamedRanges()
Gets all pre-defined named ranges in the specific worksheet.

Returns:
An array of NamedRange objects. Returns null if the named range does not exist.

autoFitColumn

public void autoFitColumn(int columnIndex,
                          int startRow,
                          int endRow)
Autofits the column width. This method autofits a column based on content in a range of cells within the column from startRow to endRow. AutoFitColumn is an imprecise function.

Parameters:
columnIndex - column index, zero based
startRow - start row index, zero based
endRow - end row index, zero based
Throws:
java.lang.IllegalArgumentException - if row indexs or column index is invalid.

autoFitColumn

public void autoFitColumn(int columnIndex)
Autofits the column width. This method autofits a column based on content in a range of cells within the column. AutoFitColumn is an imprecise function.

Parameters:
columnIndex - column index,zero based
Throws:
java.lang.IllegalArgumentException - if column index is invalid.

autoFitColumns

public void autoFitColumns(int startRow,
                           int startColumn,
                           int endRow,
                           int endColumn)
Autofits columns width in a rectangle range. AutoFitColumns is an imprecise function.

Parameters:
startRow - start row index, zero based
startColumn - column index, zero based
endRow - end row index, zero based
endColumn - column index, zero based
Throws:
java.lang.IllegalArgumentException - if row indexs or column indexs is invalid.

autoFitColumns

public void autoFitColumns(int startColumn,
                           int endColumn)
Autofits columns width from startColumn to endColumn. AutoFitColumns is an imprecise function.

Parameters:
startColumn - column index, zero based
endColumn - column index, zero based
Throws:
java.lang.IllegalArgumentException - if column indexs is invalid.

autoFitColumns

public void autoFitColumns()
Autofits all columns width in this worksheet. AutoFitColumns is an imprecise function.


autoFitRow

public void autoFitRow(int rowIndex,
                       int startColumn,
                       int endColumn)
Autofits the row height. This method autofits a row based on content in a range of cells within the row from startColumn to endColumn. AutoFitRow is an imprecise function.

Parameters:
rowIndex - row index, zero based
startColumn - start column index, zero based
endColumn - end column index, zero based
Throws:
java.lang.IllegalArgumentException - if row index or column indexs is invalid.

autoFitRow

public void autoFitRow(int rowIndex)
Autofits the row height. This method autofits a row based on content in a range of cells within the row. AutoFitRow is an imprecise function.

Parameters:
rowIndex - row index, zero based
Throws:
java.lang.IllegalArgumentException - if row index is invalid.

autoFitRows

public void autoFitRows(int startRow,
                        int startColumn,
                        int endRow,
                        int endColumn)
Autofits rows height in a rectangle range. AutoFitRows is an imprecise function.

Parameters:
startRow - start row index, zero based
startColumn - column index, zero based
endRow - end row index, zero based
endColumn - column index, zero based
Throws:
java.lang.IllegalArgumentException - if row indexs or column indexs is invalid.

autoFitRows

public void autoFitRows(int startRow,
                        int endRow)
Autofits rows height from startRow to endRow. AutoFitRows is an imprecise function.

Parameters:
startRow - start row index, zero based
endRow - end row index, zero based
Throws:
java.lang.IllegalArgumentException - if row indexs is invalid.

autoFitRows

public void autoFitRows()
Autofits all rows height in this worksheet. AutoFitRows is an imprecise function.


calculateFormula

public void calculateFormula(boolean recursive,
                             boolean ignoreError)
                      throws FormulaCalcException
Calculates all formulas in this worksheet.

Parameters:
recursive - True means if the worksheet' cells depend on the cells of other worksheets, the dependant cells in other worksheets will be calculated too. False means all the formulas in the worksheet have been calculated and the values are right.
ignoreError - Indicates if hide the error in calculating formulas. The error may be unsupported function, external links, etc.
Throws:
FormulaCalcException - if an error occurs and not hide the error.

setBackground

public void setBackground(byte[] pictureData)
Sets the background for the worksheet. If pictureData is null,it means no background. Onlys supports BMP/JPEG/PNG/WBMP image format type.

Parameters:
pictureData - the background picture data.

groupRows

@Deprecated
public void groupRows(int startIndex,
                                 int endIndex)
Deprecated. Replaced by Cells.groupRows(int,int)

Groups rows.

Parameters:
startIndex - The first row index to be grouped.
endIndex - The last row index to be grouped.

groupRows

@Deprecated
public void groupRows(int startIndex,
                                 int endIndex,
                                 boolean isHidden)
Deprecated. Replaced by Cells.groupRows(int,int,boolean)

Groups rows.

Parameters:
startIndex - The first row index to be grouped.
endIndex - The last row index to be grouped.
isHidden - Specifies if the grouped columns are hidden.

ungroupRows

@Deprecated
public void ungroupRows(int startIndex,
                                   int endIndex)
Deprecated. Replaced by Cells.ungroupRows(int,int)

Ungroups rows.

Parameters:
startIndex - The first row index to be ungrouped.
endIndex - The last row index to be ungrouped.

groupColumns

@Deprecated
public void groupColumns(int startIndex,
                                    int endIndex)
Deprecated. Replaced by Cells.groupColumns(int,int)

Groups columns.

Parameters:
startIndex - The first column index to be grouped.
endIndex - The last column index to be grouped.

groupColumns

@Deprecated
public void groupColumns(int startIndex,
                                    int endIndex,
                                    boolean isHidden)
Deprecated. Replaced by Cells.groupColumns(int,int,boolean)

Groups columns.

Parameters:
startIndex - The first column index to be grouped.
endIndex - The last column index to be grouped.
isHidden - Specifies if the grouped columns are hidden.

ungroupColumns

@Deprecated
public void ungroupColumns(int startIndex,
                                      int endIndex)
Deprecated. Replaced by Cells.ungroupColumns(int,int)

Ungroups columns.

Parameters:
startIndex - The first column index to be ungrouped.
endIndex - The last column index to be ungrouped.

getCell

@Deprecated
public Cell getCell(int rowIndex,
                               int columnIndex)
Deprecated. Replaced by Cells.getCell(int,int)

Gets the cell object with the specified row index and column index.

Parameters:
rowIndex - row index
columnIndex - column index
Returns:
the cell object at the specified row index and column index.
Throws:
java.lang.IllegalArgumentException - if any of the indexes is out of range.
CellsException - if the worksheet has been removed.

getCell

@Deprecated
public Cell getCell(java.lang.String cellName)
Deprecated. Replaced by Cells.getCell(String)

Gets the cell object by the cell name(like "A1").

Parameters:
cellName - cell name.
Returns:
the cell object.
Throws:
java.lang.IllegalArgumentException - if the cell name is invalid.
CellsException - if the worksheet has been removed from the workbook.

getRow

@Deprecated
public Row getRow(int rowIndex)
Deprecated. Replaced by Cells.getRow(int)

Gets the row at the specified row index.

Parameters:
rowIndex - row index.
Returns:
the row object.
Throws:
java.lang.IllegalArgumentException - if index is out of range.
CellsException - if the worksheet has been removed from the workbook.

insertRows

@Deprecated
public void insertRows(int rowIndex,
                                  int rowNum)
Deprecated. Replaced by Cells.insertRows(int,int)

Inserts multiple rows into the worksheet.

Parameters:
rowIndex - The row index to insert before.
rowNum - Number of rows to be inserted.
Throws:
CellsException - if the worksheet has been removed from the workbook.

insertColumns

@Deprecated
public void insertColumns(int columnIndex,
                                     int columnNum)
Deprecated. Replaced by Cells.insertColumns(int,int)

Inserts multiple columns into the worksheet.

Parameters:
columnIndex - The column index to insert before.
columnNum - Number of columns to be inserted.
Throws:
CellsException - if the worksheet has been removed from the workbook.

removeRow

@Deprecated
public void removeRow(int rowIndex)
Deprecated. Replaced by Cells.removeRow(int)

Removes the row at the given position from the worksheet. The specified row is removed and other rows remain unchanged. Use removeRows(int, int, boolean) to make more control.

Parameters:
rowIndex - row index.
Throws:
java.lang.IllegalArgumentException - if row index is out of range.
CellsException - if the worksheet has been removed from the workbook.

deleteRows

@Deprecated
public void deleteRows(int startIndex,
                                  int deletedRows,
                                  boolean bShift)
Deprecated. Replaced by Cells.deleteRows(int,int,boolean)

Removes rows from the worksheet.

Parameters:
startIndex - the first row index to be removed.
deletedRows - Number of rows to be removed.
bShift - whether the rows after the deleted rows should be shifted up.

deleteColumns

@Deprecated
public void deleteColumns(int startIndex,
                                     int deletedColumns,
                                     boolean bShift)
Deprecated. Replaced by Cells.deleteColumns(int,int,boolean)

Removes columns from the worksheet.

Parameters:
startIndex - the first column index to be removed.
deletedColumns - Number of columns to be removed.
bShift - whether the columns after the deleted columns should be shifted left.

removeCell

@Deprecated
public void removeCell(int rowIndex,
                                  int columnIndex)
Deprecated. Replaced by Cells.removeCell(int,int)

Removes a cell at the specified row index and column index from the worksheet.

Parameters:
rowIndex - row index of the cell.
columnIndex - column Index of the cell.
Throws:
java.lang.IllegalArgumentException - if any of the indexes is out of range.
CellsException - if the worksheet has been removed from the workbook.

removeCell

@Deprecated
public void removeCell(java.lang.String cellName)
Deprecated. Replaced by Cells.reomveCell(String)

Removes a cell from the worksheet by the cell name.

Parameters:
cellName - cell name.
Throws:
java.lang.IllegalArgumentException - if the cell name is invalid.
CellsException - if the worksheet has been removed from the workbook.

getDefaultColumnWidth

@Deprecated
public float getDefaultColumnWidth()
Deprecated. Replaced by Cells.getStandardWidth()

Returns the default column width of the worksheet, in unit of characters with default font.

Returns:
the default column width in characters.

setDefaultColumnWidth

@Deprecated
public void setDefaultColumnWidth(float defaultColumnWidth)
Deprecated. Replaced by Cells.setStandardWidth(float)

Sets the default column width of the worksheet, in unit of characters using default font.

Parameters:
defaultColumnWidth - the default column width of the worksheet in characters. 0-255.
Throws:
java.lang.IllegalArgumentException - if the given column width is invalid(< 0 or > 255 ).
CellsException - if the worksheet has been removed from the workbook.

getDefaultRowHeight

@Deprecated
public float getDefaultRowHeight()
Deprecated. Replaced by Cells.getStandardHeight()

Gets the default row height of the worksheet in points.

Returns:
the default row height in points.

setDefaultRowHeight

@Deprecated
public void setDefaultRowHeight(float defaultRowHeight)
Deprecated. Replaced by Cells.setStandardHeight(float)

Sets the default row height of the worksheet, in unit of points.

Parameters:
defaultRowHeight - row height in points(0-409).
Throws:
java.lang.IllegalArgumentException - if the row height is invalid.
CellsException - if the worksheet has been removed from the workbook.

setStyle

@Deprecated
public void setStyle(int startRow,
                                int endRow,
                                int startColumn,
                                int endColumn,
                                Style style)
Deprecated. Replaced by Cells.setRangeStyle(int,int,int,int,Style)

Sets a style for an area of cells.

Parameters:
startRow - start row index.
endRow - end row index.
startColumn - start column index.
endColumn - end column index.
style - style to set.
Throws:
java.lang.IllegalArgumentException - if any of the indexes is out of range, or start index is greater than end index.
CellsException - if the worksheet has been removed from the workbook.

getMergedCells

@Deprecated
public java.util.ArrayList getMergedCells()
Deprecated. Replaced by Cells.getMergedCells()

Gets the collection of merged cell ranges in the worksheet.

Returns:
CellArea collection. You can manipulate this collection to add or remove merged cells.

importResultSet

public int importResultSet(java.sql.ResultSet rs,
                           int rowIndex,
                           int columnIndex,
                           int rowNum,
                           int columnNum,
                           boolean isFieldNameShown)
                    throws java.sql.SQLException
Deprecated. Replaced by Cells.importResultSet(ResultSet,int,int,int,int,boolean)

Imports data in a ResultSet object to the worksheet.

Parameters:
rs - the ResultSet object to import from.
rowIndex - start row index in the worksheet.
columnIndex - start column index in the worksheet.
rowNum - number of rows to import.
columnNum - number of columns to import.
isFieldNameShown - Indicates whether the field name of the resultset will be imported to the first row.
Returns:
how many rows actually imported.
Throws:
java.sql.SQLException - if an error occurs while reading from the resultset.
CellsException - if the worksheet has been removed from the workbook.

importResultSet

public int importResultSet(java.sql.ResultSet rs,
                           java.lang.String startCell,
                           int rowNum,
                           int columnNum,
                           boolean isFieldNameShown)
                    throws java.sql.SQLException
Deprecated. Replaced by Cells.importResultSet(ResultSet,String,String,boolean)

Imports data in a ResultSet object to the worksheet.

Parameters:
rs - the ResultSet object to import from.
startCell - name of start cell to insert the resultset, such as "A1".
rowNum - number of rows to be imported.
columnNum - number of columns to be imported.
isFieldNameShown - Indicates whether the field name of the resultset will be imported to the first row.
Returns:
how many rows actually imported.
Throws:
java.sql.SQLException - if an error occurs while reading from the resultset.
CellsException - if the worksheet has been removed from the workbook.

importResultSet

public int importResultSet(java.sql.ResultSet rs,
                           int rowIndex,
                           int columnIndex,
                           boolean isFieldNameShown)
                    throws java.sql.SQLException
Deprecated. Replaced by Cells.importResultSet(ResultSet,int,int,boolean)

Imports data in a ResultSet object to the worksheet.

Parameters:
rs - the ResultSet object to import from.
rowIndex - start row index in the worksheet.
columnIndex - start column index in the worksheet.
isFieldNameShown - Indicates whether the field name of the resultset will be imported to the first row.
Returns:
how many rows actually imported.
Throws:
java.sql.SQLException - if an error occurs while reading from the resultset.
CellsException - if the worksheet has been removed from the workbook.

importResultSet

public int importResultSet(java.sql.ResultSet rs,
                           java.lang.String startCell,
                           boolean isFieldNameShown)
                    throws java.sql.SQLException
Deprecated. Replaced by Cells.importResultSet(ResultSet,String,boolean)

Imports data in a ResultSet object to the worksheet.

Parameters:
rs - the ResultSet object to import from.
startCell - name of start cell to insert the resultset, such as "A1".
isFieldNameShown - Indicates whether the field name of the resultset will be imported to the first row.
Returns:
how many rows actually imported.
Throws:
java.sql.SQLException - if an error occurs while reading from the resultset.
CellsException - if the worksheet has been removed from the workbook.

getFirstRowIndex

@Deprecated
public int getFirstRowIndex()
Deprecated. Replaced by Cells.getMinRow()

Returns the first defined row index.

Returns:
row index of the first defined row. Returns -1 if no row is defined.

getLastRowIndex

@Deprecated
public int getLastRowIndex()
Deprecated. Replaced by Cells.getMaxRow()

Returns the last defined row index.

Returns:
row index of the last defined row. Returns -1 if no row is defined.

getRowIterator

@Deprecated
public java.util.Iterator getRowIterator()
Deprecated. Replaced by Cells.getRowIterator()

Returns an iterator which can iterate all defined rows in this worksheet. It accesses all rows order by row index.

Returns:
an object that implements the Iterator interface.
Throws:
CellsException - if the worksheet has been removed from the workbook.

getColumnWidth

@Deprecated
public float getColumnWidth(int columnIndex)
Deprecated. Replaced by Cells.getColumnWidth(int)

Gets the width of the column at the given column index, in unit of characters using default font.

Parameters:
columnIndex - column index.
Returns:
column width in characters.
Throws:
java.lang.IllegalArgumentException - if column index is out of range.

setColumnWidth

@Deprecated
public void setColumnWidth(int columnIndex,
                                      float columnWidth)
Deprecated. Replaced by Cells.setColumnWidth(int,float)

Sets the width of the specified column, in unit of characters using default font.

Parameters:
columnIndex - column index.
columnWidth - column width in characters(0-255).
Throws:
java.lang.IllegalArgumentException - if either column index or column width is invalid.
CellsException - if the worksheet has been removed from the workbook.

isColumnHidden

@Deprecated
public boolean isColumnHidden(int columnIndex)
Deprecated. Replaced by Cells.isColumnHidden(int)

Checks if the specified column is hidden.

Parameters:
columnIndex - column index.
Returns:
true if the column is hidden.
Throws:
java.lang.IllegalArgumentException - if column index is out of range.

setColumnHidden

@Deprecated
public void setColumnHidden(int columnIndex,
                                       boolean isHidden)
Deprecated. Replaced by Cells.setColumnHidden(int,boolean)

Sets whether the specified column to be hidden or not.

Parameters:
columnIndex - column index.
isHidden - true for hidden.
Throws:
java.lang.IllegalArgumentException - if the column index is out of range.
CellsException - if the worksheet has been removed from the workbook.