asposecells.api

Class Worksheet

Encapsulates the object that represents a single worksheet.

Example:

workbook = Workbook()
sheet = workbook.getWorksheets().get(0)
# Freeze panes at "AS40" with 10 rows and 10 columns
sheet.freezePanes("AS40", 10, 10)
# Add a hyperlink in Cell A1
sheet.getHyperlinks().add("A1", 1, 1, "http://www.aspose.com")

Property Getters/Setters Summary
methodgetActiveCell()
method
           Gets or sets the active cell in the worksheet.
methodgetAllowEditRanges()
Gets the allow edit range collection in the worksheet.
methodgetAutoFilter()
Represents auto filter for the specified worksheet.
methodgetBackgroundImage()
method
           Gets and sets worksheet background image.
methodgetCells()
Gets the Cells collection.
methodgetCellWatches()
Gets collection of cells on this worksheet being watched in the 'watch window'.
methodgetCharts()
Gets a Chart collection
methodgetCheckBoxes()
Gets a CheckBox collection.
methodgetCodeName()
method
           Gets worksheet code name.
methodgetComments()
Gets the Comment collection.
methodgetConditionalFormattings()
Gets the ConditionalFormattings in the worksheet.
methodgetCustomProperties()
Gets an object representing the identifier information associated with a worksheet.
methodgetDisplayRightToLeft()
method
           Indicates if the specified worksheet is displayed from right to left instead of from left to right. Default is false.
methodgetDisplayZeros()
method
           True if zero values are displayed.
methodgetErrorCheckOptions()
Gets error check setting applied on certain ranges.
methodgetFirstVisibleColumn()
method
           Represents first visible column index.
methodgetFirstVisibleRow()
method
           Represents first visible row index.
methodhasAutofilter()
Indicates whether this worksheet has auto filter.
methodgetHorizontalPageBreaks()
Gets the HorizontalPageBreakCollection collection.
methodgetHyperlinks()
Gets the HyperlinkCollection collection.
methodgetIndex()
Gets the index of sheet in the worksheet collection.
methodisGridlinesVisible()
method
           Gets or sets a value indicating whether the gridlines are visible.Default is true.
methodisOutlineShown()
method
           Indicates whether to show outline.
methodisPageBreakPreview()
method
           Indicates whether the specified worksheet is shown in normal view or page break preview.
methodisProtected()
Indicates if the worksheet is protected.
methodisRowColumnHeadersVisible()
method
           Gets or sets a value indicating whether the worksheet will display row and column headers. Default is true.
methodisRulerVisible()
method
           Indicates whether the ruler is visible. This property is only applied for page break preview.
methodisSelected()
method
           Indicates whether this worksheet is selected when the workbook is opened.
methodisVisible()
method
setVisible(value)
           Represents if the worksheet is visible.
methodgetListObjects()
Gets all ListObjects in this worksheet.
methodgetName()
method
setName(value)
           Gets or sets the name of the worksheet.
methodgetOleObjects()
Represents a collection of OleObject in a worksheet.
methodgetOutline()
Gets the outline on this worksheet.
methodgetPageSetup()
Represents the page setup description in this sheet.
methodgetPaneState()
Indicates whether the pane has horizontal or vertical splits, and whether those splits are frozen. The value of the property is PaneStateType integer constant.
methodgetPictures()
Gets a Picture collection.
methodgetPivotTables()
Gets all pivot tables in this worksheet.
methodgetProtection()
Represents the various types of protection options available for a worksheet. Supports advanced protection options in ExcelXP and above version.
methodgetQueryTables()
Gets QueryTableCollection in the worksheet.
methodgetScenarios()
Gets the collection of Scenario.
methodgetShapes()
Returns all drawing shapes in this worksheet.
methodgetShowFormulas()
method
           Indicates whether to show formulas or their results.
methodgetSlicers()
Get the Slicer collection in the worksheet
methodgetSmartTagSetting()
Gets all SmartTagCollection objects of the worksheet.
methodgetSparklineGroupCollection()
Gets the sparkline group collection in the worksheet.
methodgetSparklineGroups()
Gets the sparkline groups in the worksheet.
methodgetTabColor()
method
           Represents worksheet tab color.
methodgetTabId()
method
setTabId(value)
           Specifies the internal identifier for the sheet.
methodgetTextBoxes()
Gets a TextBox collection.
methodgetTimelines()
Get the Timeline collection in the worksheet
methodgetTransitionEntry()
method
           Indicates whether the Transition Formula Entry (Lotus compatibility) option is enabled.
methodgetTransitionEvaluation()
method
           Indicates whether the Transition Formula Evaluation (Lotus compatibility) option is enabled.
methodgetType()
method
setType(value)
           Represents worksheet type. The value of the property is SheetType integer constant.
methodgetUniqueId()
method
           Gets and sets the unique id, it is same as {15DB5C3C-A5A1-48AF-8F25-3D86AC232D4F}.
methodgetValidations()
Gets the data validation setting collection in the worksheet.
methodgetVerticalPageBreaks()
Gets the VerticalPageBreakCollection collection.
methodgetViewType()
method
           Gets and sets the view type. The value of the property is ViewType integer constant.
methodgetVisibilityType()
method
           Indicates the visible state for this sheet. The value of the property is VisibilityType integer constant.
methodgetWorkbook()
Gets the workbook object which contains this sheet.
methodgetZoom()
method
setZoom(value)
           Represents the scaling factor in percentage. It should be between 10 and 400.
 
Method Summary
methodaddPageBreaks(cellName)
Adds page break.
methodadvancedFilter(isFilter, listRange, criteriaRange, copyTo, uniqueRecordOnly)
Filters data using complex criteria.
methodautoFitColumn(columnIndex)
Autofits the column width.
methodautoFitColumn(columnIndex, firstRow, lastRow)
Autofits the column width.
methodautoFitColumns()
Autofits all columns in this worksheet.
methodautoFitColumns(options)
Autofits all columns in this worksheet.
methodautoFitColumns(firstColumn, lastColumn)
Autofits the columns width.
methodautoFitColumns(firstColumn, lastColumn, options)
Autofits the columns width.
methodautoFitColumns(firstRow, firstColumn, lastRow, lastColumn)
Autofits the columns width.
methodautoFitColumns(firstRow, firstColumn, lastRow, lastColumn, options)
Autofits the columns width.
methodautoFitRow(rowIndex)
Autofits the row height.
methodautoFitRow(rowIndex, firstColumn, lastColumn)
Autofits the row height.
methodautoFitRow(rowIndex, firstColumn, lastColumn, options)
Autofits the row height.
methodautoFitRow(startRow, endRow, startColumn, endColumn)
Autofits row height in a rectangle range.
methodautoFitRows()
Autofits all rows in this worksheet.
methodautoFitRows(onlyAuto)
Autofits all rows in this worksheet.
methodautoFitRows(options)
Autofits all rows in this worksheet.
methodautoFitRows(startRow, endRow)
Autofits row height in a range.
methodautoFitRows(startRow, endRow, options)
Autofits row height in a range.
methodcalculateArrayFormula(formula, opts)
Calculates a formula as array formula.
methodcalculateArrayFormula(formula, opts, maxRowCount, maxColumnCount)
Calculates a formula as array formula.
methodcalculateArrayFormula(formula, pOpts, cOpts, baseCellRow, baseCellColumn, maxRowCount, maxColumnCount, calculationData)
Calculates a formula as array formula.
methodcalculateFormula(options, recursive)
Calculates all formulas in this worksheet.
methodcalculateFormula(formula)
Calculates a formula.
methodcalculateFormula(formula, opts)
Calculates a formula expression directly.
methodcalculateFormula(formula, pOpts, cOpts, baseCellRow, baseCellColumn, calculationData)
Calculates a formula expression directly.
methodclearComments()
Clears all comments in designer spreadsheet.
methodcloseAccessCache(opts)
Closes the session that uses caches to access the data in this worksheet.
methodconvertFormulaReferenceStyle(formula, toR1C1, baseCellRow, baseCellColumn)
Converts the formula reference style.
methodcopy(sourceSheet)
Copies contents and formats from another worksheet.
methodcopy(sourceSheet, copyOptions)
Copies contents and formats from another worksheet.
methoddispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
methodfreezePanes(row, column, freezedRows, freezedColumns)
Freezes panes at the specified cell in the worksheet.
methodfreezePanes(cellName, freezedRows, freezedColumns)
Freezes panes at the specified cell in the worksheet.
methodgetFreezedPanes()
Gets the freeze panes.
methodgetPanes()
Gets the window panes.
methodgetPrintingPageBreaks(options)
Gets automatic page breaks.
methodgetSelectedRanges()
Gets selected ranges of cells in the designer spreadsheet.
methodmoveTo(index)
Moves the sheet to another location in the spreadsheet.
methodprotect(type)
Protects worksheet.
methodprotect(type, password, oldPassword)
Protects worksheet.
methodrefreshPivotTables()
Refreshes all the PivotTables in this Worksheet.
methodremoveAllDrawingObjects()
Removes all drawing objects in this worksheet.
methodremoveAutoFilter()
Removes the auto filter of the worksheet.
methodremoveSplit()
Removes split window.
methodreplace(oldString, newString)
Replaces all cells' text with a new string.
methodselectRange(startRow, startColumn, totalRows, totalColumns, removeOthers)
Selects a range.
methodsetBackground(pictureData)
Sets worksheet background image.
methodsetVisible(isVisible, ignoreError)
Sets the visible options.
methodsplit()
Splits window.
methodstartAccessCache(opts)
Starts the session that uses caches to access the data in this worksheet.
methodtoString()
Returns a string represents the current Worksheet object.
methodunFreezePanes()
Unfreezes panes in the worksheet.
methodunprotect()
Unprotects worksheet.
methodunprotect(password)
Unprotects worksheet.
methodxmlMapQuery(path, xmlMap)
Query cell areas that mapped/linked to the specific path of xml map.
 

    • Property Getters/Setters Detail

      • getProtection : Protection 

        Protection getProtection()
        
        Represents the various types of protection options available for a worksheet. Supports advanced protection options in ExcelXP and above version. This property can protect worksheet in all versions of Excel file and support advanced protection options in ExcelXP and above version.
      • getUniqueId/setUniqueId : String 

        String getUniqueId() / setUniqueId(value)
        
        Gets and sets the unique id, it is same as {15DB5C3C-A5A1-48AF-8F25-3D86AC232D4F}.
      • getWorkbook : Workbook 

        Workbook getWorkbook()
        
        Gets the workbook object which contains this sheet.
      • getCells : Cells 

        Cells getCells()
        
        Gets the Cells collection.
      • getType/setType : int 

        int getType() / setType(value)
        
        Represents worksheet type. The value of the property is SheetType integer constant.
      • getName/setName : String 

        String getName() / setName(value)
        
        Gets or sets the name of the worksheet. 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.
      • getShowFormulas/setShowFormulas : boolean 

        boolean getShowFormulas() / setShowFormulas(value)
        
        Indicates whether to show formulas or their results.
      • isGridlinesVisible/setGridlinesVisible : boolean 

        boolean isGridlinesVisible() / setGridlinesVisible(value)
        
        Gets or sets a value indicating whether the gridlines are visible.Default is true.
      • isRowColumnHeadersVisible/setRowColumnHeadersVisible : boolean 

        boolean isRowColumnHeadersVisible() / setRowColumnHeadersVisible(value)
        
        Gets or sets a value indicating whether the worksheet will display row and column headers. Default is true.
      • getPaneState : int 

        int getPaneState()
        
        Indicates whether the pane has horizontal or vertical splits, and whether those splits are frozen. The value of the property is PaneStateType integer constant.
      • getDisplayZeros/setDisplayZeros : boolean 

        boolean getDisplayZeros() / setDisplayZeros(value)
        
        True if zero values are displayed.
      • getDisplayRightToLeft/setDisplayRightToLeft : boolean 

        boolean getDisplayRightToLeft() / setDisplayRightToLeft(value)
        
        Indicates if the specified worksheet is displayed from right to left instead of from left to right. Default is false.
      • isOutlineShown/setOutlineShown : boolean 

        boolean isOutlineShown() / setOutlineShown(value)
        
        Indicates whether to show outline.
      • isSelected/setSelected : boolean 

        boolean isSelected() / setSelected(value)
        
        Indicates whether this worksheet is selected when the workbook is opened.
      • getTabId/setTabId : int 

        int getTabId() / setTabId(value)
        
        Specifies the internal identifier for the sheet.
      • getPageSetup : PageSetup 

        PageSetup getPageSetup()
        
        Represents the page setup description in this sheet.
      • getAutoFilter : AutoFilter 

        AutoFilter getAutoFilter()
        
        Represents auto filter for the specified worksheet.
      • hasAutofilter : boolean 

        boolean hasAutofilter()
        
        Indicates whether this worksheet has auto filter.
      • getTransitionEvaluation/setTransitionEvaluation : boolean 

        boolean getTransitionEvaluation() / setTransitionEvaluation(value)
        
        Indicates whether the Transition Formula Evaluation (Lotus compatibility) option is enabled.
      • getTransitionEntry/setTransitionEntry : boolean 

        boolean getTransitionEntry() / setTransitionEntry(value)
        
        Indicates whether the Transition Formula Entry (Lotus compatibility) option is enabled.
      • getVisibilityType/setVisibilityType : int 

        int getVisibilityType() / setVisibilityType(value)
        
        Indicates the visible state for this sheet. The value of the property is VisibilityType integer constant.
      • isVisible/setVisible : boolean 

        boolean isVisible() / setVisible(value)
        
        Represents if the worksheet is visible.
      • getSparklineGroupCollection : SparklineGroupCollection 

        SparklineGroupCollection getSparklineGroupCollection()
        
        Gets the sparkline group collection in the worksheet. NOTE: This member is now obsolete. Instead, please use Worksheet.SparklineGroups property. This property will be removed 12 months later since November 2022. Aspose apologizes for any inconvenience you may have experienced.
      • getIndex : int 

        int getIndex()
        
        Gets the index of sheet in the worksheet collection.
      • isProtected : boolean 

        boolean isProtected()
        
        Indicates if the worksheet is protected.
      • getOutline : Outline 

        Outline getOutline()
        
        Gets the outline on this worksheet.
      • getFirstVisibleRow/setFirstVisibleRow : int 

        int getFirstVisibleRow() / setFirstVisibleRow(value)
        
        Represents first visible row index.
      • getFirstVisibleColumn/setFirstVisibleColumn : int 

        int getFirstVisibleColumn() / setFirstVisibleColumn(value)
        
        Represents first visible column index.
      • getZoom/setZoom : int 

        int getZoom() / setZoom(value)
        
        Represents the scaling factor in percentage. It should be between 10 and 400. Please set the view type first.
      • getViewType/setViewType : int 

        int getViewType() / setViewType(value)
        
        Gets and sets the view type. The value of the property is ViewType integer constant.
      • isPageBreakPreview/setPageBreakPreview : boolean 

        boolean isPageBreakPreview() / setPageBreakPreview(value)
        
        Indicates whether the specified worksheet is shown in normal view or page break preview.
      • isRulerVisible/setRulerVisible : boolean 

        boolean isRulerVisible() / setRulerVisible(value)
        
        Indicates whether the ruler is visible. This property is only applied for page break preview.
      • getTabColor/setTabColor : Color 

        Color getTabColor() / setTabColor(value)
        
        Represents worksheet tab color. This feature is only supported in ExcelXP(Excel2002) and later versions. If you save file as Excel97 or Excel2000 format, it will be omitted.
      • getCodeName/setCodeName : String 

        String getCodeName() / setCodeName(value)
        
        Gets worksheet code name.
      • getBackgroundImage/setBackgroundImage : byte[] 

        byte[] getBackgroundImage() / setBackgroundImage(value)
        
        Gets and sets worksheet background image.
      • getActiveCell/setActiveCell : String 

        String getActiveCell() / setActiveCell(value)
        
        Gets or sets the active cell in the worksheet.
      • getCustomProperties : CustomPropertyCollection 

        CustomPropertyCollection getCustomProperties()
        
        Gets an object representing the identifier information associated with a worksheet. Worksheet.CustomProperties provide a preferred mechanism for storing arbitrary data. It supports legacy third-party document components, as well as those situations that have a stringent need for binary parts.
    • Method Detail

      • replace

        int replace(oldString, newString)
        Replaces all cells' text with a new string.
        Parameters:
        oldString: String - Old string value.
        newString: String - New string value.
      • getSelectedRanges

        ArrayList getSelectedRanges()
        Gets selected ranges of cells in the designer spreadsheet.
        Returns:
        An java.util.ArrayList which contains selected ranges.
      • setBackground

         setBackground(pictureData)
        Sets worksheet background image. NOTE: This member is now obsolete. Instead, please use Worksheet.BackgroundImage property. This property will be removed 12 months later since August 2016. Aspose apologizes for any inconvenience you may have experienced.
        Parameters:
        pictureData: byte[] - Picture data.
      • getPrintingPageBreaks

        CellArea[] getPrintingPageBreaks(options)
        Gets automatic page breaks. Each cell area represents a paper.
        Parameters:
        options: ImageOrPrintOptions - The print options
        Returns:
        The automatic page breaks areas.
      • toString

        String toString()
        Returns a string represents the current Worksheet object.
        Returns:
      • startAccessCache

         startAccessCache(opts)
        Starts the session that uses caches to access the data in this worksheet. After finishing the access to the data, closeAccessCache(int) should be invoked with same options to clear all caches and recover normal access mode.
        Parameters:
        opts: int - A AccessCacheOptions value. options of data access
      • closeAccessCache

         closeAccessCache(opts)
        Closes the session that uses caches to access the data in this worksheet.
        Parameters:
        opts: int - A AccessCacheOptions value. options of data access
      • convertFormulaReferenceStyle

        String convertFormulaReferenceStyle(formula, toR1C1, baseCellRow, baseCellColumn)
        Converts the formula reference style.
        Parameters:
        formula: String - The formula to be converted.
        toR1C1: boolean - Which reference style to convert the formula to. If the original formula is of A1 reference style, then this value should be true so the formula will be converted from A1 to R1C1 reference style; If the original formula is of R1C1 reference style, then this value should be false so the formula will be converted from R1C1 to A1 reference style;
        baseCellRow: int - The row index of the base cell.
        baseCellColumn: int - The column index of the base cell.
        Returns:
        The converted formula.
      • calculateFormula

        Object calculateFormula(formula)
        Calculates a formula.
        Parameters:
        formula: String - Formula to be calculated.
        Returns:
        Calculated formula result.
      • calculateFormula

        Object calculateFormula(formula, opts)
        Calculates a formula expression directly. The formula will be calculated just like it has been set to cell A1. And the formula will be taken as normal formula. If you need the formula be calculated as an array formula and to get an array for the calculated result, please use calculateArrayFormula(java.lang.String, com.aspose.cells.CalculationOptions) instead.
        Parameters:
        formula: String - Formula to be calculated.
        opts: CalculationOptions - Options for calculating formula
        Returns:
        Calculated result of given formula. The returned object may be of possible types of Cell.Value, or ReferredArea.
      • calculateFormula

        Object calculateFormula(formula, pOpts, cOpts, baseCellRow, baseCellColumn, calculationData)
        Calculates a formula expression directly. The formula will be calculated just like it has been set to the specified base cell. And the formula will be taken as normal formula. If you need the formula be calculated as an array formula and to get an array for the calculated result, please use calculateArrayFormula(java.lang.String, com.aspose.cells.FormulaParseOptions, com.aspose.cells.CalculationOptions, int, int, int, int, com.aspose.cells.CalculationData) instead.
        Parameters:
        formula: String - Formula to be calculated.
        pOpts: FormulaParseOptions - Options for parsing formula.
        cOpts: CalculationOptions - Options for calculating formula.
        baseCellRow: int - The row index of the base cell.
        baseCellColumn: int - The column index of the base cell.
        calculationData: CalculationData - The calculation data. It is used for the situation that user needs to calculate some static formulas when implementing custom calculation engine. For such kind of situation, user needs to specify it with the calculation data provided for #Error Cref: M:Aspose.Cells.AbstractCalculationEngine.Calculate(Aspose.Cells.CalculationData).
        Returns:
        Calculated result of given formula. The returned object may be of possible types of Cell.Value, or ReferredArea.
      • calculateArrayFormula

        Object[][] calculateArrayFormula(formula, opts)
        Calculates a formula as array formula.
        Parameters:
        formula: String - Formula to be calculated.
        opts: CalculationOptions - Options for calculating formula
      • calculateArrayFormula

        Object[][] calculateArrayFormula(formula, opts, maxRowCount, maxColumnCount)
        Calculates a formula as array formula. The formula will be taken as dynamic array formula to calculate the dimension and result. User specified maximum dimension is used for cases that the calculated result is large data set (for example, the calculated result may correspond to a whole row or column data) but user does not need so large an array according to business requirement or for performance consideration.
        Parameters:
        formula: String - Formula to be calculated.
        opts: CalculationOptions - Options for calculating formula
        maxRowCount: int - the maximum row count of resultant data. If it is non-positive or greater than the actual row count, then actual row count will be used.
        maxColumnCount: int - the maximum column count of resultant data. If it is non-positive or greater than the actual row count, then actual column count will be used.
        Returns:
        Calculated formula result.
      • calculateArrayFormula

        Object[][] calculateArrayFormula(formula, pOpts, cOpts, baseCellRow, baseCellColumn, maxRowCount, maxColumnCount, calculationData)
        Calculates a formula as array formula. The formula will be taken as dynamic array formula to calculate the dimension and result. User specified maximum dimension is used for cases that the calculated result is large data set (for example, the calculated result may correspond to a whole row or column data) but user does not need so large an array according to business requirement or for performance consideration.
        Parameters:
        formula: String - Formula to be calculated.
        pOpts: FormulaParseOptions - Options for parsing formula
        cOpts: CalculationOptions - Options for calculating formula
        baseCellRow: int - The row index of the base cell.
        baseCellColumn: int - The column index of the base cell.
        maxRowCount: int - The maximum row count of resultant data. If it is non-positive or greater than the actual row count, then actual row count will be used.
        maxColumnCount: int - The maximum column count of resultant data. If it is non-positive or greater than the actual row count, then actual column count will be used.
        calculationData: CalculationData - The calculation data. It is used for the situation that user needs to calculate some static formulas when implementing custom calculation engine. For such kind of situation, user needs to specify it with the calculation data provided for #Error Cref: M:Aspose.Cells.AbstractCalculationEngine.Calculate(Aspose.Cells.CalculationData).
        Returns:
        Calculated formula result.
      • calculateFormula

         calculateFormula(options, recursive)
        Calculates all formulas in this worksheet.
        Parameters:
        options: CalculationOptions - Options for calculation
        recursive: boolean - True means if the worksheet' cells depend on the cells of other worksheets, the dependent cells in other worksheets will be calculated too. False means all the formulas in the worksheet have been calculated and the values are right.
      • xmlMapQuery

        ArrayList xmlMapQuery(path, xmlMap)
        Query cell areas that mapped/linked to the specific path of xml map. e.g. A xml map element structure: -RootElement |-Attribute1 |-SubElement |-Attribute2 |-Attribute3 To query "Attribute1", path is "/RootElement/@Attribute1" To query "Attribute2", path is "/RootElement/SubElement/@Attribute2" To query whole "SubElement", path is "/RootElement/SubElement"
        Parameters:
        path: String - xml element path
        xmlMap: XmlMap - Specify an xml map if you want to query for the specific path within a specific map
        Returns:
        CellArea list that mapped/linked to the specific path of xml map, an empty list is returned if nothing is mapped/linked.
      • refreshPivotTables

         refreshPivotTables()
        Refreshes all the PivotTables in this Worksheet.
      • dispose

         dispose()
        Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
      • getPanes

        PaneCollection getPanes()
        Gets the window panes. If the window is not split or frozen.
      • freezePanes

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

        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 froze position and the last two parameters specify the area frozen on the left top pane.

        Parameters:
        row: int - Row index.
        column: int - Column index.
        freezedRows: int - Number of visible rows in top pane, no more than row index.
        freezedColumns: int - Number of visible columns in left pane, no more than column index.
      • getFreezedPanes

        int[] getFreezedPanes()
        Gets the freeze panes.
        Returns:
        Return null means the worksheet is not frozen 0:Row index;1:column;2:freezedRows;3:freezedRows
      • split

         split()
        Splits window.
      • freezePanes

         freezePanes(cellName, freezedRows, freezedColumns)
        Freezes panes at the specified cell in the worksheet. Row index and column index cannot all be zero. Number of rows and number of columns also cannot all be zero.
        Parameters:
        cellName: String - Cell name.
        freezedRows: int - Number of visible rows in top pane, no more than row index.
        freezedColumns: int - Number of visible columns in left pane, no more than column index.
      • unFreezePanes

         unFreezePanes()
        Unfreezes panes in the worksheet.
      • removeSplit

         removeSplit()
        Removes split window.
      • addPageBreaks

         addPageBreaks(cellName)
        Adds page break.
        Parameters:
        cellName: String -
      • copy

         copy(sourceSheet)
        Copies contents and formats from another worksheet.
        Parameters:
        sourceSheet: Worksheet - Source worksheet.
      • copy

         copy(sourceSheet, copyOptions)
        Copies contents and formats from another worksheet. You can copy data from another worksheet in the same file or another file. However, this method does not support to copy drawing objects, such as comments, images and charts.
        Parameters:
        sourceSheet: Worksheet - Source worksheet.
        copyOptions: CopyOptions -
      • autoFitColumn

         autoFitColumn(columnIndex, firstRow, lastRow)
        Autofits the column width. This method autofits a row based on content in a range of cells within the row.
        Parameters:
        columnIndex: int - Column index.
        firstRow: int - First row index.
        lastRow: int - Last row index.
      • autoFitColumns

         autoFitColumns()
        Autofits all columns in this worksheet.
      • autoFitColumns

         autoFitColumns(options)
        Autofits all columns in this worksheet.
        Parameters:
        options: AutoFitterOptions - The auto fitting options
      • autoFitColumn

         autoFitColumn(columnIndex)
        Autofits the column width. AutoFitColumn is an imprecise function.
        Parameters:
        columnIndex: int - Column index.
      • autoFitColumns

         autoFitColumns(firstColumn, lastColumn)
        Autofits the columns width. AutoFitColumn is an imprecise function.
        Parameters:
        firstColumn: int - First column index.
        lastColumn: int - Last column index.
      • autoFitColumns

         autoFitColumns(firstColumn, lastColumn, options)
        Autofits the columns width. AutoFitColumn is an imprecise function.
        Parameters:
        firstColumn: int - First column index.
        lastColumn: int - Last column index.
        options: AutoFitterOptions - The auto fitting options
      • autoFitColumns

         autoFitColumns(firstRow, firstColumn, lastRow, lastColumn)
        Autofits the columns width. AutoFitColumn is an imprecise function.
        Parameters:
        firstRow: int - First row index.
        firstColumn: int - First column index.
        lastRow: int - Last row index.
        lastColumn: int - Last column index.
      • autoFitColumns

         autoFitColumns(firstRow, firstColumn, lastRow, lastColumn, options)
        Autofits the columns width. AutoFitColumn is an imprecise function.
        Parameters:
        firstRow: int - First row index.
        firstColumn: int - First column index.
        lastRow: int - Last row index.
        lastColumn: int - Last column index.
        options: AutoFitterOptions - The auto fitting options
      • autoFitRow

         autoFitRow(rowIndex, firstColumn, lastColumn)
        Autofits the row height. This method autofits a row based on content in a range of cells within the row.
        Parameters:
        rowIndex: int - Row index.
        firstColumn: int - First column index.
        lastColumn: int - Last column index.
      • autoFitRow

         autoFitRow(rowIndex, firstColumn, lastColumn, options)
        Autofits the row height. This method autofits a row based on content in a range of cells within the row.
        Parameters:
        rowIndex: int - Row index.
        firstColumn: int - First column index.
        lastColumn: int - Last column index.
        options: AutoFitterOptions - The auto fitter options
      • autoFitRows

         autoFitRows()
        Autofits all rows in this worksheet.
      • autoFitRows

         autoFitRows(onlyAuto)
        Autofits all rows in this worksheet.
        Parameters:
        onlyAuto: boolean - True,only autofits the row height when row height is not customed.
      • autoFitRows

         autoFitRows(options)
        Autofits all rows in this worksheet.
        Parameters:
        options: AutoFitterOptions - The auto fitter options
      • autoFitRows

         autoFitRows(startRow, endRow)
        Autofits row height in a range.
        Parameters:
        startRow: int - Start row index.
        endRow: int - End row index.
      • autoFitRows

         autoFitRows(startRow, endRow, options)
        Autofits row height in a range.
        Parameters:
        startRow: int - Start row index.
        endRow: int - End row index.
        options: AutoFitterOptions - The options of auto fitter.
      • autoFitRow

         autoFitRow(startRow, endRow, startColumn, endColumn)
        Autofits row height in a rectangle range.
        Parameters:
        startRow: int - Start row index.
        endRow: int - End row index.
        startColumn: int - Start column index.
        endColumn: int - End column index.
      • autoFitRow

         autoFitRow(rowIndex)
        Autofits the row height. AutoFitRow is an imprecise function.
        Parameters:
        rowIndex: int - Row index.
      • advancedFilter

         advancedFilter(isFilter, listRange, criteriaRange, copyTo, uniqueRecordOnly)
        Filters data using complex criteria.
        Parameters:
        isFilter: boolean - Indicates whether filtering the list in place.
        listRange: String - The list range.
        criteriaRange: String - The criteria range.
        copyTo: String - The range where copying data to.
        uniqueRecordOnly: boolean - Only displaying or copying unique rows.
      • removeAutoFilter

         removeAutoFilter()
        Removes the auto filter of the worksheet.
      • setVisible

         setVisible(isVisible, ignoreError)
        Sets the visible options.
        Parameters:
        isVisible: boolean - Whether the worksheet is visible
        ignoreError: boolean - Whether to ignore error if this option is not valid.
      • selectRange

         selectRange(startRow, startColumn, totalRows, totalColumns, removeOthers)
        Selects a range.
        Parameters:
        startRow: int - The start row.
        startColumn: int - The start column
        totalRows: int - The number of rows.
        totalColumns: int - The number of columns
        removeOthers: boolean - True means removing other selected range and only select this range.
      • removeAllDrawingObjects

         removeAllDrawingObjects()
        Removes all drawing objects in this worksheet.
      • clearComments

         clearComments()
        Clears all comments in designer spreadsheet.
      • protect

         protect(type)
        Protects worksheet. This method protects worksheet without password. It can protect worksheet in all versions of Excel file.
        Parameters:
        type: int - A ProtectionType value. Protection type.
      • protect

         protect(type, password, oldPassword)
        Protects worksheet. This method can protect worksheet in all versions of Excel file.
        Parameters:
        type: int - A ProtectionType value. Protection type.
        password: String - Password.
        oldPassword: String - If the worksheet is already protected by a password, please supply the old password. Otherwise, you can set a null value or blank string to this parameter.

        Example:

        # Instantiating a Workbook object
        excel = Workbook("Book2.xlsx")
        # Accessing the first worksheet in the Excel file
        worksheet = excel.getWorksheets().get(0)
        # Protecting the worksheet with a password
        worksheet.protect(ProtectionType.ALL, "aspose", None)
        # Saving the modified Excel file in default (that is Excel 20003) format
        excel.save("Book1.xls")
      • unprotect

         unprotect()
        Unprotects worksheet. This method unprotects worksheet which is protected without password.
      • unprotect

         unprotect(password)
        Unprotects worksheet. If the worksheet is protected without a password, you can set a null value or blank string to password parameter.
        Parameters:
        password: String - Password
      • moveTo

         moveTo(index)
        Moves the sheet to another location in the spreadsheet.
        Parameters:
        index: int - Destination sheet index.