Class SheetImpl

    • Method Detail

      • checkOwnership

        protected void checkOwnership​(SPicture picture)
      • checkOwnership

        protected void checkOwnership​(SChart chart)
      • checkOwnership

        protected void checkOwnership​(SDataValidation validation)
      • getBook

        public SBook getBook()
        Description copied from interface: SSheet
        Get the owner book
        Returns:
        the owner book
      • getSheetName

        public String getSheetName()
        Description copied from interface: SSheet
        Get the sheet name
        Returns:
        the sheet name
      • getRow

        public SRow getRow​(int rowIdx)
      • getColumn

        public SColumn getColumn​(int columnIdx)
      • setupColumnArray

        public SColumnArray setupColumnArray​(int index,
                                             int lastIndex)
        Description copied from interface: SSheet
        Set up a column array, if one array range overlaps another, it throws IllegalStateException. If you setup a column array that is not continuous, (for example, 0~2, 5~6), then it will create a missing column array automatically to make them continuous.(3~4 in the example). It's required to set up in ascending order of starting column index (min), or it will create unexpected SColumnArray for columns are not continuous.
        Parameters:
        index - index of the starting column
        lastIndex - index of the end column
        Returns:
        the new created column array
      • getCell

        public SCell getCell​(int rowIdx,
                             int columnIdx)
        Description copied from interface: SSheet
        This method always returns not-null cell object. Use SCell.isNull() to know it's null (blank) or not.
      • getCell

        public SCell getCell​(String cellRef)
        Returns:
        return a cell with specified cell reference, e.g. A2, B3. Area reference, A1:A2, is not acceptable.
        See Also:
        SSheet.getCell(int, int)
      • getStartRowIndex

        public int getStartRowIndex()
      • getEndRowIndex

        public int getEndRowIndex()
      • getStartColumnIndex

        public int getStartColumnIndex()
      • getEndColumnIndex

        public int getEndColumnIndex()
      • getStartCellIndex

        public int getStartCellIndex​(int rowIdx)
      • getEndCellIndex

        public int getEndCellIndex​(int rowIdx)
      • clearCell

        public void clearCell​(CellRegion region)
        Description copied from interface: SSheet
        Clear cells in specified region
      • insertRow

        public void insertRow​(int rowIdx,
                              int lastRowIdx)
        Description copied from interface: SSheet
        insert rows specified by first and last index
      • deleteRow

        public void deleteRow​(int rowIdx,
                              int lastRowIdx)
        Description copied from interface: SSheet
        delete rows specified by first and last index
      • insertCell

        public void insertCell​(CellRegion region,
                               boolean horizontal)
        Description copied from interface: SSheet
        Insert a region of cells and shift existing cells.
        Parameters:
        region - the region of cells to insert
        horizontal - TRUE for shifting right, FALSE for shifting down
      • deleteCell

        public void deleteCell​(CellRegion region,
                               boolean horizontal)
        Description copied from interface: SSheet
        Delete a region of cells and shift existing cells.
        Parameters:
        region - the region of cells to delete
        horizontal - TRUE for shifting left, FALSE for shifting up
      • insertColumn

        public void insertColumn​(int columnIdx,
                                 int lastColumnIdx)
        Description copied from interface: SSheet
        insert columns specified by first and last index
      • deleteColumn

        public void deleteColumn​(int columnIdx,
                                 int lastColumnIdx)
        Description copied from interface: SSheet
        delete columns specified by first and last index
      • moveCell

        public void moveCell​(CellRegion region,
                             int rowOffset,
                             int columnOffset)
        Description copied from interface: SSheet
        Move one or more cells.
        Parameters:
        region - the region of cells to move
        rowOffset - positive number to move down, negative to move up
        columnOffset - positive number to move right, negative to move left
      • moveCell

        public void moveCell​(int rowIdx,
                             int columnIdx,
                             int lastRowIdx,
                             int lastColumnIdx,
                             int rowOffset,
                             int columnOffset)
        Description copied from interface: SSheet
        Move a region of cells specified by 4 indexes.
        See Also:
        SSheet.moveCell(CellRegion, int, int)
      • checkOrphan

        public void checkOrphan()
      • destroy

        public void destroy()
        Description copied from interface: LinkedModelObject
        Destroy / release this model object, for example all the dependency, parent linking. this method has to be called before remove this linking from parent object
      • getId

        public String getId()
        Returns:
        interal sheet object ID
      • addPicture

        public SPicture addPicture​(SPicture.Format format,
                                   byte[] data,
                                   ViewAnchor anchor)
        Description copied from interface: SSheet
        Add a picture into this sheet with raw picture data and format.
        Parameters:
        format - picture format as specified in SPicture.Format
        data - raw byte data of the picture
        anchor - where to anchor this picture
        Returns:
        the added SPicture
      • addPicture

        public SPicture addPicture​(int picDataIndex,
                                   ViewAnchor anchor)
        Description copied from interface: SSheet
        Add a picture into the sheet with known picture data index.
        Parameters:
        picDataIndex - SPictureData index
        anchor - where to anchor this picture
        Returns:
        the SPicture added
      • deletePicture

        public void deletePicture​(SPicture picture)
      • getNumOfPicture

        public int getNumOfPicture()
      • getPicture

        public SPicture getPicture​(int idx)
      • deleteChart

        public void deleteChart​(SChart chart)
      • getNumOfChart

        public int getNumOfChart()
      • getChart

        public SChart getChart​(int idx)
      • removeMergedRegion

        public void removeMergedRegion​(CellRegion region,
                                       boolean removeOverlaps)
        Description copied from interface: SSheet
        Remove the merged area that are contained by region
        removeOverlaps - true if you want to remove the merged areas that are just overlapped.
      • addMergedRegion

        public void addMergedRegion​(CellRegion region)
        Description copied from interface: SSheet
        Add a merged area, you can't assign a area that overlaps existed merged area.
      • getOverlapsMergedRegions

        public List<CellRegion> getOverlapsMergedRegions​(CellRegion region,
                                                         boolean excludeContains)
        Description copied from interface: SSheet
        Get the merged region that overlapped the region
        Returns:
        the regions that overlaps
      • getContainsMergedRegions

        public List<CellRegion> getContainsMergedRegions​(CellRegion region)
        Description copied from interface: SSheet
        Get the merged region that are contained by region.
        Returns:
        the regions that are contained
      • getMergedRegion

        public CellRegion getMergedRegion​(int row,
                                          int column)
      • getAttribute

        public Object getAttribute​(String name)
        Description copied from interface: SSheet
        Get the runtime custom attribute that stored in this sheet
        Parameters:
        name - the attribute name
        Returns:
        the value, or null if not found
      • setAttribute

        public Object setAttribute​(String name,
                                   Object value)
        Description copied from interface: SSheet
        Set the runtime custom attribute to stored in this sheet, the attribute is only use for developer to stored runtime data in the sheet, values will not stored to excel when exporting.
        Parameters:
        name - name the attribute name
        value - the attribute value
      • getAttributes

        public Map<String,​Object> getAttributes()
        Description copied from interface: SSheet
        Get the unmodifiable runtime attributes map
        Returns:
      • getRowIterator

        public Iterator<SRow> getRowIterator()
        Returns:
        an iterator of existing rows excluding those blank rows
      • getRowIterator

        public Iterator<SRow> getRowIterator​(int start,
                                             int end)
        Parameters:
        start - the start index
        end - the end index
        Returns:
        an iterator of existing rows excluding those blank rows
      • getColumnIterator

        public Iterator<SColumn> getColumnIterator()
        Returns:
        an iterator of existing columns excluding those blank columns
      • getCellIterator

        public Iterator<SCell> getCellIterator​(int row)
      • getDefaultRowHeight

        public int getDefaultRowHeight()
        Returns:
        default row height in pixels
      • getDefaultColumnWidth

        public int getDefaultColumnWidth()
        Returns:
        default column width in pixels
      • setDefaultRowHeight

        public void setDefaultRowHeight​(int height)
        Description copied from interface: SSheet
        set default row height in pixels
      • setDefaultColumnWidth

        public void setDefaultColumnWidth​(int width)
        Description copied from interface: SSheet
        set default column width in pixels
      • getNumOfMergedRegion

        public int getNumOfMergedRegion()
      • getMergedRegion

        public CellRegion getMergedRegion​(int idx)
      • isProtected

        public boolean isProtected()
        Description copied from interface: SSheet
        Check if the sheet is protected
        Returns:
      • setTabColor

        public void setTabColor​(String tabColor)
        Description copied from interface: SSheet
        Set sheet tab color
      • getTabColor

        public String getTabColor()
        Returns:
        sheet tab color
      • setPassword

        public void setPassword​(String password)
        Description copied from interface: SSheet
        Sets password to protect sheet, set null to unprotect it.
      • getHashedPassword

        public short getHashedPassword()
        Description copied from interface: SSheet
        Internal Use only.
        Returns:
      • deleteDataValidation

        public void deleteDataValidation​(SDataValidation validationid)
      • deleteDataValidationRegion

        public List<SDataValidation> deleteDataValidationRegion​(CellRegion region)
        Description copied from interface: SSheet
        Delete data validations that are covered by the specified region.
        Parameters:
        region - the cover region
        Returns:
        the data validations deleted
      • getNumOfDataValidation

        public int getNumOfDataValidation()
      • getDataValidation

        public SDataValidation getDataValidation​(int idx)
      • getDataValidation

        public SDataValidation getDataValidation​(int rowIdx,
                                                 int columnIdx)
        Returns:
        the first data validation at row, column
      • getAutoFilter

        public SAutoFilter getAutoFilter()
        Description copied from interface: SSheet
        Gets the auto filter information if there is.
        Returns:
        the auto filter, or null if not found
      • createAutoFilter

        public SAutoFilter createAutoFilter​(CellRegion region)
        Description copied from interface: SSheet
        Creates a new auto filter, the old one will be drop directly.
        Parameters:
        region - the auto filter region
        Returns:
        the new auto filter.
      • deleteAutoFilter

        public void deleteAutoFilter()
        Description copied from interface: SSheet
        Delete current autofilter if it has
      • clearAutoFilter

        public void clearAutoFilter()
        Description copied from interface: SSheet
        Clear auto filter if there is.
      • pasteCell

        public CellRegion pasteCell​(SheetRegion src,
                                    CellRegion dest,
                                    PasteOption option)
        Description copied from interface: SSheet
        paste cell from src sheet to this sheet, the sheets must in same book
        Parameters:
        src - src sheet and it's region to paste
        dest - destination region in this sheet
        option - the copy option
        Returns:
        the final effected region
      • getSheetProtection

        public SSheetProtection getSheetProtection()
        Description copied from interface: SSheet
        Gets enhanced protection.
      • setHashedPassword

        public void setHashedPassword​(short hashpass)
        Description copied from interface: SSheet
        Internal User only.
      • getSheetVisible

        public SSheet.SheetVisible getSheetVisible()
        Description copied from interface: SSheet
        Get the sheet current visible state.
      • setSheetVisible

        public void setSheetVisible​(SSheet.SheetVisible state)
        Description copied from interface: SSheet
        Set the sheet current visible state.
      • addTable

        public void addTable​(STable table)
        Description copied from interface: SSheet
        Add a new table
      • getTables

        public List<STable> getTables()
        Description copied from interface: SSheet
        Get tables in this sheet
        Returns:
      • removeTable

        public void removeTable​(String name)
        Description copied from interface: SSheet
        Remove the table of the specified table name.
      • setHashValue

        public void setHashValue​(String hashValue)
        Description copied from interface: SSheet
        New way of hashing sheet protection password.
      • getHashValue

        public String getHashValue()
      • setSpinCount

        public void setSpinCount​(String spinCount)
        Description copied from interface: SSheet
        New way of hashing sheet protection password.
      • getSpinCount

        public String getSpinCount()
      • setSaltValue

        public void setSaltValue​(String saltValue)
        Description copied from interface: SSheet
        New way of hashing sheet protection password.
      • getSaltValue

        public String getSaltValue()
      • setAlgName

        public void setAlgName​(String algName)
        Description copied from interface: SSheet
        New way of hashing sheet protection password.
      • getAlgName

        public String getAlgName()
      • addDirectlyMergedRegion

        public void addDirectlyMergedRegion​(CellRegion region)
      • getConditionalFormattings

        public List<SConditionalFormatting> getConditionalFormattings()
        Description copied from interface: SSheet
        Returns the conditional formatting applied to this sheet.
        Returns:
      • getDataRegion

        public CellRegion getDataRegion()
        Description copied from interface: SSheet
        Returns the region which contains data(including chart, picture, and fills) in this sheet; return null if empty sheet.
        Returns:
        the region which contains data(including chart, picture, and fills) in this sheet; return null if empty sheet.
      • setArrayFormula

        public CellRegion setArrayFormula​(String formula,
                                          CellRegion region)
        Description copied from interface: SSheet
        Sets array formula to specified region for result.

        Note if there are shared formulas this will invalidate any FormulaEvaluator instances based on this workbook

        Parameters:
        formula - text representation of the formula
        region - Region of array formula for result.
        Returns:
        the CellRegion of cells affected by this change
      • removeArrayFormula

        public CellRegion removeArrayFormula​(SCell cell)
        Description copied from interface: SSheet
        Remove an Array Formula from this sheet. All cells contained in the Array Formula range are removed as well
        Parameters:
        cell - any cell within Array Formula range
        Returns:
        the CellRegion of cells affected by this change
      • getCellRegionInArrayFormula

        public CellRegion getCellRegionInArrayFormula​(SCell cell)
        Description copied from interface: SSheet
        Returns the cell regin if the given cell is in an array formula.
      • setOutlineLevelRow

        public void setOutlineLevelRow​(int outlineLevelRow)
        Description copied from interface: SSheet
        Sets the maximum outline level for row represent of this sheet.
      • getOutlineLevelRow

        public int getOutlineLevelRow()
        Description copied from interface: SSheet
        Returns the maximum outline level for row represent.
      • setOutlineLevelCol

        public void setOutlineLevelCol​(int outlineLevelCol)
        Description copied from interface: SSheet
        Sets the maximum outline level for column represent of this sheet.
      • getOutlineLevelCol

        public int getOutlineLevelCol()
        Description copied from interface: SSheet
        Returns the maximum outline level for column represent.
      • isApplyStyles

        public boolean isApplyStyles()
        Description copied from interface: SSheet
        Returns whether to apply the styles in outline.

        Default: false

      • setApplyStyles

        public void setApplyStyles​(boolean applyStyles)
        Description copied from interface: SSheet
        Sets to apply with the styles in outline.

        Note: Only used for maintaining model state. (not implemented for UI parts)

        Parameters:
        applyStyles - false not to apply
      • isSummaryBelow

        public boolean isSummaryBelow()
        Description copied from interface: SSheet
        Returns whether to display summary below in outline for rows.

        Default: true

      • setSummaryBelow

        public void setSummaryBelow​(boolean summaryBelow)
        Description copied from interface: SSheet
        Sets to display summary below in outline for rows.

        Default: true

        Parameters:
        summaryBelow - false to display on top.
      • isSummaryRight

        public boolean isSummaryRight()
        Description copied from interface: SSheet
        Returns whether to display summary right in outline for columns.

        Default: true

      • setSummaryRight

        public void setSummaryRight​(boolean summaryRight)
        Description copied from interface: SSheet
        Sets whether to display summary right in outline for columns.

        Default: true

        Parameters:
        summaryRight - false to display on left.
      • isShowOutlineSymbols

        public boolean isShowOutlineSymbols()
        Description copied from interface: SSheet
        Returns whether to display outline symbols.

        Default: true

      • setShowOutlineSymbols

        public void setShowOutlineSymbols​(boolean showOutlineSymbols)
        Description copied from interface: SSheet
        Sets whether to display outline symbols.

        Default: true

        Parameters:
        showOutlineSymbols - false not to show.
      • syncOutlineLevelRowTree

        public void syncOutlineLevelRowTree()
      • syncOutlineLevelColTree

        public void syncOutlineLevelColTree()