Class RangeImpl

java.lang.Object
io.keikai.range.impl.RangeImpl
All Implemented Interfaces:
SRange, Serializable
Direct Known Subclasses:
PasteRangeImpl

public class RangeImpl extends Object implements SRange, Serializable
Only those methods that set cell data, cell style, row (column) style, width, height, and hidden consider 3-D references. Others don't, just perform on first cell.
Since:
3.5.0
Author:
dennis
See Also:
  • Constructor Details

    • RangeImpl

      public RangeImpl(SBook book)
    • RangeImpl

      public RangeImpl(SSheet sheet)
    • RangeImpl

      public RangeImpl(SSheet sheet, int row, int col)
    • RangeImpl

      public RangeImpl(SSheet sheet, int tRow, int lCol, int bRow, int rCol)
    • RangeImpl

      public RangeImpl(SSheet sheet, CellRegion region)
  • Method Details

    • getLock

      public ReadWriteLock getLock()
      Specified by:
      getLock in interface SRange
    • getBookSeries

      public SBookSeries getBookSeries()
      Description copied from interface: SRange
      Returns the associated SBookSeries of this range.
      Specified by:
      getBookSeries in interface SRange
      Returns:
      the associated BookSeries
    • getBook

      public SBook getBook()
      Description copied from interface: SRange
      Returns the associated SBook of this range.
      Specified by:
      getBook in interface SRange
      Returns:
      the associaed Book
    • tracePrecedents

      public void tracePrecedents()
      Description copied from interface: SRange
      Trace the dependents of this range.
      Specified by:
      tracePrecedents in interface SRange
    • traceDependents

      public void traceDependents()
      Description copied from interface: SRange
      Trace the precedent of this range.
      Specified by:
      traceDependents in interface SRange
    • clearTrace

      public void clearTrace()
      Description copied from interface: SRange
      Clears the tracing of this range.
      Specified by:
      clearTrace in interface SRange
    • getSheet

      public SSheet getSheet()
      Description copied from interface: SRange
      Returns associate SSheet of this range.
      Specified by:
      getSheet in interface SRange
      Returns:
      associate SSheet of this range.
    • getRow

      public int getRow()
      Description copied from interface: SRange
      Returns the number of the 1st row of the 1st area in this Range(0-based; i.e. row1 return 0)
      Specified by:
      getRow in interface SRange
      Returns:
      the number of the 1st row of the 1st area in this Range(0-based; i.e. row1 return 0)
    • getColumn

      public int getColumn()
      Description copied from interface: SRange
      Returns the number of the 1st column of the 1st area in this Range(0-based; i.e. Column A return 0)
      Specified by:
      getColumn in interface SRange
      Returns:
      the number of the 1st column of the 1st area in this Range(0-based; i.e. Column A return 0)
    • getLastRow

      public int getLastRow()
      Description copied from interface: SRange
      Returns the number of the last row of the 1st area in this Range(0-based; i.e. row1 return 0)
      Specified by:
      getLastRow in interface SRange
      Returns:
      the number of the last row of the 1st area in this Range(0-based; i.e. row1 return 0)
    • getLastColumn

      public int getLastColumn()
      Description copied from interface: SRange
      Returns the number of the last column of the 1st area in this Range(0-based; i.e. Column A return 0)
      Specified by:
      getLastColumn in interface SRange
      Returns:
      the number of the last column of the 1st area in this Range(0-based; i.e. Column A return 0)
    • setRichText

      public void setRichText(String html)
      Description copied from interface: SRange
      Set rich text into the left top cell of this range.
      Specified by:
      setRichText in interface SRange
    • getRichText

      public String getRichText()
      Description copied from interface: SRange
      Return the rich edit text of the left top cell of this Range.
      Specified by:
      getRichText in interface SRange
      Returns:
      the rich edit text of this Range.
    • setValue

      public void setValue(Object value)
      Description copied from interface: SRange
      Set value into this Range.
      Specified by:
      setValue in interface SRange
      Parameters:
      value - the value
    • setValues

      public void setValues(Object... values)
      Description copied from interface: SRange
      Set values into this Range from left to right and top to bottom consistently.
      Specified by:
      setValues in interface SRange
      Parameters:
      values - the values
    • clearContents

      public void clearContents()
      Description copied from interface: SRange
      Clears the data from this Range.
      Specified by:
      clearContents in interface SRange
    • clearCellStyles

      public void clearCellStyles()
      Description copied from interface: SRange
      Clear the cell styles of this Range
      Specified by:
      clearCellStyles in interface SRange
    • clearAll

      public void clearAll()
      Description copied from interface: SRange
      Clear data contains, style and unmerge this range
      Specified by:
      clearAll in interface SRange
    • setEditText

      public void setEditText(String editText)
      Description copied from interface: SRange
      Set plain text as input by the end user.
      Specified by:
      setEditText in interface SRange
      Parameters:
      editText - the string input by the end user.
    • setArrayFormula

      public void setArrayFormula(String editText)
      Description copied from interface: SRange
      Set an array formula as input by the end user.
      Specified by:
      setArrayFormula in interface SRange
      Parameters:
      editText - the string input by the end user.
    • getEditText

      public String getEditText()
      Description copied from interface: SRange
      Return the edit text of this Range.
      Specified by:
      getEditText in interface SRange
      Returns:
      the edit text of this Range.
    • notifyChange

      public void notifyChange()
      Description copied from interface: SRange
      Notify this range has been changed.
      Specified by:
      notifyChange in interface SRange
    • notifyChange

      public void notifyChange(CellAttribute cellAttr)
      Description copied from interface: SRange
      Notify this range has been changed with the specified attribute.
      Specified by:
      notifyChange in interface SRange
    • notifyChange

      public void notifyChange(String[] variables)
      Description copied from interface: SRange
      Notify the variables in this range has been changed.
      Specified by:
      notifyChange in interface SRange
    • isWholeSheet

      public boolean isWholeSheet()
      Description copied from interface: SRange
      Check if this range cover an entire sheet
      Specified by:
      isWholeSheet in interface SRange
    • isWholeRow

      public boolean isWholeRow()
      Description copied from interface: SRange
      Check if this range cover an entire rows (form 0, and last row to the max available row of a sheet)
      Specified by:
      isWholeRow in interface SRange
    • getRows

      public SRange getRows()
      Description copied from interface: SRange
      Returns a SRange that represent rows of the 1st selected area of this Range. Note that only the 1st selected area is considered if this Range is a multiple-selected Range.
      Specified by:
      getRows in interface SRange
      Returns:
      a SRange that represent rows of this Range and contains all columns of the rows.
    • setRowHeight

      public void setRowHeight(int heightPx)
      Description copied from interface: SRange
      Sets row height in unit of pixel
      Specified by:
      setRowHeight in interface SRange
    • setRowHeight

      public void setRowHeight(int heightPx, boolean custom)
      Description copied from interface: SRange
      Sets the height(in pixel) of row in this range, it effects to whole row.
      Specified by:
      setRowHeight in interface SRange
      Parameters:
      heightPx - width in pixel
      custom - mark it as custom value
    • isWholeColumn

      public boolean isWholeColumn()
      Description copied from interface: SRange
      Check if this range cover an entire columns (form 0, and last row to the max available column of a sheet)
      Specified by:
      isWholeColumn in interface SRange
    • getColumns

      public SRange getColumns()
      Description copied from interface: SRange
      Returns a SRange that represent columns of the 1st selected area of this Range. Note that only the 1st selected area is considered if this Range is a multiple-selected Range.
      Specified by:
      getColumns in interface SRange
      Returns:
      a SRange that represent columns of this Range and contains all rows of the column.
    • setColumnWidth

      public void setColumnWidth(int widthPx)
      Description copied from interface: SRange
      Sets column width in unit of pixel
      Specified by:
      setColumnWidth in interface SRange
    • setColumnWidth

      public void setColumnWidth(int widthPx, boolean custom)
      Description copied from interface: SRange
      Sets the width(in pixel) of column in this range, it effects to whole column.
      Specified by:
      setColumnWidth in interface SRange
      Parameters:
      widthPx - width in pixel
      custom - mark it as custom value
    • getHyperlink

      public SHyperlink getHyperlink()
      Description copied from interface: SRange
      Returns the hyperlink of this Range.
      Specified by:
      getHyperlink in interface SRange
      Returns:
      hyperlink of this Range
    • copy

      public SRange copy(SRange dstRange, boolean cut)
      Description copied from interface: SRange
      cut the selected range and paste to destination range.
      Specified by:
      copy in interface SRange
      Returns:
      the real destination range.
    • copy

      public SRange copy(SRange dstRange)
      Description copied from interface: SRange
      Copy data from this range to the specified destination range.
      Specified by:
      copy in interface SRange
      Parameters:
      dstRange - the destination range.
      Returns:
      the real destination range.
    • pasteSpecial

      public SRange pasteSpecial(SRange dstRange, SRange.PasteType pasteType, SRange.PasteOperation pasteOp, boolean skipBlanks, boolean transpose)
      Description copied from interface: SRange
      Pastes to a destination Range from this range.
      Specified by:
      pasteSpecial in interface SRange
      Parameters:
      dstRange - the destination range to be pasted into.
      pasteType - the part of the range to be pasted.
      pasteOp - the paste operation
      skipBlanks - true to not have blank cells in the ranage to paste into destination Range; default false.
      transpose - true to transpose rows and columns when pasting to this range; default false.
      Returns:
      real destination range that was pasted into.
    • pasteSpecial0

      public SRange pasteSpecial0(SRange dstRange, PasteOption option)
    • insert

      public void insert(SRange.InsertShift shift, SRange.InsertCopyOrigin copyOrigin)
      Description copied from interface: SRange
      Insert cells of this Range.
      Specified by:
      insert in interface SRange
      Parameters:
      shift - can be SRange.InsertShift.DEFAULT, {SRange.InsertShift.DOWN, or SRange.InsertShift.RIGHT.
      copyOrigin - from where to copy the format to the insert area(SRange.InsertCopyOrigin.FORMAT_LEFT_ABOVE / SRange.InsertCopyOrigin.FORMAT_RIGHT_BELOW)
    • delete

      public void delete(SRange.DeleteShift shift)
      Description copied from interface: SRange
      Delete cells of this Range.
      Specified by:
      delete in interface SRange
      Parameters:
      shift - can be SRange.DeleteShift.DEFAULT, {SRange.DeleteShift.UP, or SRange.DeleteShift.LEFT.
    • merge

      public void merge(boolean across)
      Description copied from interface: SRange
      Merge cells of this range into a merged cell.
      Specified by:
      merge in interface SRange
      Parameters:
      across - true to merge cells in each row; default to false.
    • unmerge

      public void unmerge()
      Description copied from interface: SRange
      Un-merge a merged cell in this range to separated cells.
      Specified by:
      unmerge in interface SRange
    • setBorders

      public void setBorders(SRange.ApplyBorderType borderType, SBorder.BorderType lineStyle, String color)
      Description copied from interface: SRange
      Adds/Remove border of all cells within this range upon the specified border type.
      Specified by:
      setBorders in interface SRange
      Parameters:
      borderType - one of SRange.ApplyBorderType
      lineStyle - border line style, one of SBorder.BorderType
      color - color in HTML format; i.e., #rrggbb.
    • move

      public void move(int nRow, int nCol)
      Description copied from interface: SRange
      Move this range to a new place as specified by row offset (negative value to move up; positive value to move down) and column offset(negative value to move left; positive value to move right)
      Specified by:
      move in interface SRange
      Parameters:
      nRow - how many rows to move this range
      nCol - how many columns to move this range
    • setCellStyle

      public void setCellStyle(SCellStyle style)
      Description copied from interface: SRange
      Sets a Style object to this Range.
      Specified by:
      setCellStyle in interface SRange
      Parameters:
      style - the style object
    • getCellStyle

      public SCellStyle getCellStyle()
      Description copied from interface: SRange
      Gets the first(top-left) cell's style
      Specified by:
      getCellStyle in interface SRange
      Returns:
    • fill

      public void fill(SRange dstRange, SRange.FillType fillType)
      Description copied from interface: SRange
      Perform an auto fill on the specified destination Range. Note the given destination Range must include this source Range.
      Specified by:
      fill in interface SRange
      Parameters:
      dstRange - destination range to do the auto fill. Note the given destination Range must include this source Range
      fillType - the fillType
    • fillDown

      public void fillDown()
      Description copied from interface: SRange
      Fills down from the top cells of this Range to the rest of this Range.
      Specified by:
      fillDown in interface SRange
    • fillLeft

      public void fillLeft()
      Description copied from interface: SRange
      Fills left from the rightmost cells of this Range to the rest of this Range.
      Specified by:
      fillLeft in interface SRange
    • fillRight

      public void fillRight()
      Description copied from interface: SRange
      Fills right from the leftmost cells of this Range to the rest of this Range.
      Specified by:
      fillRight in interface SRange
    • fillUp

      public void fillUp()
      Description copied from interface: SRange
      Fills up from the bottom cells of this Range to the rest of this Range.
      Specified by:
      fillUp in interface SRange
    • setHidden

      public void setHidden(boolean hidden)
      Description copied from interface: SRange
      Sets whether this rows or columns are hidden(useful only if this Range cover entire column or entire row)
      Specified by:
      setHidden in interface SRange
      Parameters:
      hidden - true to hide this rows or columns
    • setHiddenInLock

      protected void setHiddenInLock(boolean hidden)
    • setDisplayGridlines

      public void setDisplayGridlines(boolean show)
      Description copied from interface: SRange
      Sets whether show the gridlines of the sheets in this Range.
      Specified by:
      setDisplayGridlines in interface SRange
      Parameters:
      show - true to show the gridlines; false to not show the gridlines.
    • setHyperlink

      public void setHyperlink(SHyperlink.HyperlinkType linkType, String address, String display)
      Description copied from interface: SRange
      Sets the hyperlink of this Range
      Specified by:
      setHyperlink in interface SRange
      Parameters:
      linkType - the type of target to link. One of the SHyperlink.HyperlinkType.URL, SHyperlink.HyperlinkType.DOCUMENT, SHyperlink.HyperlinkType.EMAIL, SHyperlink.HyperlinkType.FILE
      address - the address
      display - the text to display link
    • getValue

      public Object getValue()
      Description copied from interface: SRange
      Returns left top cell value of this Range.
      Specified by:
      getValue in interface SRange
      Returns:
      left top cell value of this Range
    • getValues

      public List<Object> getValues()
      Description copied from interface: SRange
      Returns all cell values from left to right and top to bottom of this Range in one dimension list.
      Specified by:
      getValues in interface SRange
      Returns:
      all cell values of this Range.
    • getOffset

      public SRange getOffset(int rowOffset, int colOffset)
      Description copied from interface: SRange
      Returns a SRange that represents a range that offset from this Range.
      Specified by:
      getOffset in interface SRange
      Parameters:
      rowOffset - positive means downward; 0 means don't change row; negative means upward.
      colOffset - positive means rightward; 0 means don't change column; negative means leftward.
      Returns:
      a SRange that represents a range that offset from this Range.
    • isAnyCellProtected

      public boolean isAnyCellProtected()
      Description copied from interface: SRange
      Returns whether any cell is protected and locked in this Range.
      Specified by:
      isAnyCellProtected in interface SRange
      Returns:
      true if any cell is protected and locked in this Range.
    • deleteSheet

      public void deleteSheet()
      Description copied from interface: SRange
      Delete sheet of this Range.
      Specified by:
      deleteSheet in interface SRange
    • createSheet

      public SSheet createSheet(String name)
      Description copied from interface: SRange
      Create sheet of this book as specified in this Range.
      Specified by:
      createSheet in interface SRange
      Parameters:
      name - the name of the new created sheet; null would use default "SheetX" name where X is the next sheet number.
    • cloneSheet

      public SSheet cloneSheet(String name)
      Description copied from interface: SRange
      Clone sheet as specified in this Range.
      Specified by:
      cloneSheet in interface SRange
      Parameters:
      name - the name of the new created sheet; null would use default "SheetX" name where X is the next sheet number.
    • setSheetName

      public void setSheetName(String newname)
      Description copied from interface: SRange
      Set(Rename) the name of the sheet as specified in this Range.
      Specified by:
      setSheetName in interface SRange
    • setSheetOrder

      public void setSheetOrder(int pos)
      Description copied from interface: SRange
      Sets the order of the sheet as specified in this Range.
      Specified by:
      setSheetOrder in interface SRange
      Parameters:
      pos - the position that we want to insert the sheet into (0 based)
    • setFreezePanel

      public void setFreezePanel(int numOfRow, int numOfColumn)
      Description copied from interface: SRange
      Set the freeze panel
      Specified by:
      setFreezePanel in interface SRange
      Parameters:
      numOfRow - the number of row to freeze, 0 means no freeze
      numOfColumn - the number of column to freeze, 0 means no freeze
    • getCellFormatText

      public String getCellFormatText()
      Description copied from interface: SRange
      Gets the first(top-left) cell's formatted text, if the cell's format is the special LOCALE aware format (such as m/d/yyyy), it will formats the value by transferred format (e.g m/d/yyyy will transfer to yyyy/m/d in TW locale)
      Specified by:
      getCellFormatText in interface SRange
      Returns:
    • getCellDataFormat

      public String getCellDataFormat()
      Description copied from interface: SRange
      Gets the first(top-left) cell's format, if the cell's format is the special LOCALE aware format (such as m/d/yyyy), it transfer the format by LOCALE(e.g m/d/yyyy will transfer to yyyy/m/d in TW locale)
      Specified by:
      getCellDataFormat in interface SRange
      Returns:
    • isSheetProtected

      public boolean isSheetProtected()
      Description copied from interface: SRange
      Gets whether the sheet of the first region of this Range is protected.
      Specified by:
      isSheetProtected in interface SRange
      Returns:
    • validate

      public SDataValidation validate(String editText)
      Description copied from interface: SRange
      Returns whether the plain text input by the end user is valid or not; note the validation only applies to the left-top cell of this Range.
      Specified by:
      validate in interface SRange
      Parameters:
      editText - the string input by the end user.
      Returns:
      null if a valid input to the specified range; otherwise, the DataValidation
    • findAutoFilterRange

      public SRange findAutoFilterRange()
      Description copied from interface: SRange
      To find a range of cells for applying auto filter according to this range. Usually, these two ranges are different. This method searches the filtering range through a specific rules.
      Specified by:
      findAutoFilterRange in interface SRange
      Returns:
      a range of cells for applying auto filter or null if can't find one from this Range.
    • enableAutoFilter

      public SAutoFilter enableAutoFilter(boolean enable)
      Description copied from interface: SRange
      Enable the auto filter and return it, get null if you disable it.
      Specified by:
      enableAutoFilter in interface SRange
      Returns:
      the autofilter if enable, or null if disable.
    • enableAutoFilter

      public SAutoFilter enableAutoFilter(int field, SAutoFilter.FilterOp filterOp, Object criteria1, Object criteria2, Boolean visibleDropDown)
      Description copied from interface: SRange
      Filters a list specified by this Range and returns an AutoFilter object.
      Specified by:
      enableAutoFilter in interface SRange
      Parameters:
      field - offset of the field on which you want to base the filter on (1-based; i.e. leftmost column in this range is field 1).
      filterOp - , Use FILTEROP_AND and FILTEROP_OR with criteria1 and criterial2 to construct compound criteria.
      criteria1 - "=" to find blank fields, "<>" to find non-blank fields. If null, means ALL. If filterOp == AutoFilter#FILTEROP_TOP10, then this shall specifies the number of items (e.g. "10").
      criteria2 - 2nd criteria; used with criteria1 and filterOP to construct compound criteria.
      visibleDropDown - true to show the autoFilter drop-down arrow for the filtered field; false to hide the autoFilter drop-down arrow; null to keep as is.
      Returns:
      the applied AutoFiltering
    • resetAutoFilter

      public void resetAutoFilter()
      Description copied from interface: SRange
      Reset the autofilter, clear the condition, shows all the hidden row
      Specified by:
      resetAutoFilter in interface SRange
    • applyAutoFilter

      public void applyAutoFilter()
      Description copied from interface: SRange
      Apply the autofilter with the old condition and current cell values
      Specified by:
      applyAutoFilter in interface SRange
    • notifyCustomEvent

      public void notifyCustomEvent(String customEventName, Object data, boolean writelock)
      Description copied from interface: SRange
      Send a custom model event to all book's listener, the event name must not conflict with that in ModelEvents
      Specified by:
      notifyCustomEvent in interface SRange
      Parameters:
      customEventName - the event custom event
      data - the data
      writelock - use write lock when notify , set true if the synchronized book listener will modify the book.
    • addPicture

      public SPicture addPicture(ViewAnchor anchor, byte[] image, SPicture.Format format)
      Description copied from interface: SRange
      Add a picture into the sheet of this Range
      Specified by:
      addPicture in interface SRange
      Returns:
      the created picture
    • deletePicture

      public void deletePicture(SPicture picture)
      Description copied from interface: SRange
      Delete an existing picture from the sheet of this Range.
      Specified by:
      deletePicture in interface SRange
      Parameters:
      picture - the picture to be deleted
    • movePicture

      public void movePicture(SPicture picture, ViewAnchor anchor)
      Description copied from interface: SRange
      Update picture anchor. Can be used to resize or move a picture.
      Specified by:
      movePicture in interface SRange
      Parameters:
      picture - the picture to change
      anchor - the new anchor
    • addChart

      public SChart addChart(ViewAnchor anchor, SChart.ChartType type, SChart.ChartGrouping grouping, SChart.ChartLegendPosition pos, boolean isThreeD)
      Description copied from interface: SRange
      Add a chart into the sheet of this Range
      Specified by:
      addChart in interface SRange
      Returns:
      the created chart
    • addChart

      public SChart addChart(String name, ViewAnchor anchor, SChart.ChartType type, SChart.ChartGrouping grouping, SChart.ChartLegendPosition pos, boolean isThreeD)
      Description copied from interface: SRange
      Add a chart into the sheet of this Range
      Specified by:
      addChart in interface SRange
      Returns:
      the created chart
    • deleteChart

      public void deleteChart(SChart chart)
      Description copied from interface: SRange
      Delete an existing chart from the sheet of this Range.
      Specified by:
      deleteChart in interface SRange
      Parameters:
      chart - the chart to be deleted
    • moveChart

      public void moveChart(SChart chart, ViewAnchor anchor)
      Description copied from interface: SRange
      Move the chart to the new anchor.
      Specified by:
      moveChart in interface SRange
      Parameters:
      chart - the chart to change anchor
      anchor - the new anchor
    • updateChart

      public void updateChart(SChart chart)
      Description copied from interface: SRange
      Notify the model that a chart contains change, for example, chart data changes.
      Specified by:
      updateChart in interface SRange
      Parameters:
      chart - the chart that changes
    • sort

      public void sort(SRange key1, boolean descending1, SRange.SortDataOption dataOption1, SRange key2, boolean descending2, SRange.SortDataOption dataOption2, SRange key3, boolean descending3, SRange.SortDataOption dataOption3, int hasHeader, boolean matchCase, boolean sortByRows)
      Description copied from interface: SRange
      Sort this Range according the specified parameters
      Specified by:
      sort in interface SRange
      Parameters:
      key1 - key1 for sorting
      descending1 - true to do descending sort; false to do ascending sort for key1.
      dataOption1 - see numeric String as number or not for key1.
      key2 - key2 for sorting
      descending2 - true to do descending sort; false to do ascending sort for key2.
      dataOption2 - see numeric String as number or not for key2.
      key3 - key3 for sorting
      descending3 - true to do descending sort; false to do ascending sort for key3.
      dataOption3 - see numeric String as number or not for key3.
      hasHeader - whether sort range includes header
      matchCase - true to match the string cases; false to ignore string cases
      sortByRows - true to sort by rows(change columns orders); false to sort by columns(change row orders).
    • createName

      public void createName(String nameName)
      Description copied from interface: SRange
      Create a SName that refer to this range.
      Specified by:
      createName in interface SRange
      Parameters:
      nameName - name of the SName that you can refer in formulas.
    • isProtected

      public boolean isProtected()
      Description copied from interface: SRange
      Gets the first region's protection status; return true if the sheet of the first region is protected and some cells in the region is locked.
      Specified by:
      isProtected in interface SRange
    • protectSheet

      public void protectSheet(String password, boolean allowSelectingLockedCells, boolean allowSelectingUnlockedCells, boolean allowFormattingCells, boolean allowFormattingColumns, boolean allowFormattingRows, boolean allowInsertColumns, boolean allowInsertRows, boolean allowInsertingHyperlinks, boolean allowDeletingColumns, boolean allowDeletingRows, boolean allowSorting, boolean allowFiltering, boolean allowUsingPivotTables, boolean drawingObjects, boolean scenarios)
      Description copied from interface: SRange
      Protect a SSheet so that it cannot be modified.
      Specified by:
      protectSheet in interface SRange
      Parameters:
      password - a case-sensitive password for the sheet; null means sheet is not password protected.
      allowSelectingLockedCells - true to allow select locked cells; default to true.
      allowSelectingUnlockedCells - true to allow select unlocked cells; default to true.
      allowFormattingCells - true to allow user to format any cell on the protected sheet; default false.
      allowFormattingColumns - true to allow user to format any columns on the protected sheet; default false.
      allowFormattingRows - true to allow user to format any rows on the protected sheet; default false.
      allowInsertColumns - true to allow user to insert columns on the protected sheet; default false.
      allowInsertRows - true to allow user to insert rows on the protected sheet; default false.
      allowInsertingHyperlinks - true to allow user to insert hyperlinks on the protected sheet; default false.
      allowDeletingColumns - true to allow user to delete columns on the protected sheet; default false.
      allowDeletingRows - true to allow user to delete rows on the protected sheet; default false.
      allowSorting - true to allow user to sort on the protected sheet; default false.
      allowFiltering - true to allow user to set filters on the protected sheet; default false.
      allowUsingPivotTables - true to allow user to use pivot table reports on the protected sheet; default false.
      drawingObjects - true to protect objects; default to false.
      scenarios - true to protect scenarios; default to true.
    • unprotectSheet

      public boolean unprotectSheet(String password)
      Description copied from interface: SRange
      Removes protection from a sheet. This method has no effect if the sheet isn't protected.
      Specified by:
      unprotectSheet in interface SRange
      Parameters:
      password - a case-sensitive password used to unprotect the sheet. If the sheet isn't protected with a password, this argument is ignored. If you omit this argument for a sheet that is protected with a password, you'll be prompted for the password.
    • getSheetProtection

      public SSheetProtection getSheetProtection()
      Description copied from interface: SRange
      Gets SSheetProtection protection options that tells what are allowed operations for the protected sheet of the first region of this range.
      Specified by:
      getSheetProtection in interface SRange
      Returns:
    • setValidation

      public void setValidation(SDataValidation.ValidationType validationType, boolean ignoreBlank, SDataValidation.OperatorType operatorType, boolean inCellDropDown, String formula1, String formula2, boolean showInput, String inputTitle, String inputMessage, boolean showError, SDataValidation.AlertStyle alertStyle, String errorTitle, String errorMessage)
      Description copied from interface: SRange
      Add if not exist or modify an existing SDataValidation to this range.
      Specified by:
      setValidation in interface SRange
      Parameters:
      validationType - the type of this validation
      ignoreBlank - true if blank values are permitted.
      operatorType - the operator for this validation
      inCellDropDown - true if want to display dropdown list for acceptable values.
      formula1 - the value or expression associated with conditional format or data validation.
      formula2 - the 2nd part of a conditional format or data validation. Useful only when operatorType is BETWEEN or NOT_BETWEEN.
      showInput - true to show the input message.
      inputTitle - title for the data-validation input dialog box.
      inputMessage - message for the data-validation input dialog box.
      showError - true to show the error message.
      alertStyle - validation alert style.
      errorTitle - title of the data validation error dialog.
      errorMessage - data validation error message.
    • getValidations

      public List<SDataValidation> getValidations()
      Description copied from interface: SRange
      Gets SDataValidations associated with this range; if more than one validation is present, will return at most two.
      Specified by:
      getValidations in interface SRange
      See Also:
    • deleteValidation

      public void deleteValidation()
      Description copied from interface: SRange
      Delete the SDataValidation associated in the specified range.
      Specified by:
      deleteValidation in interface SRange
    • getOrCreateFont

      public SFont getOrCreateFont(SFont.Boldweight boldweight, String htmlColor, int fontHeight, String fontName, boolean italic, boolean strikeout, SFont.TypeOffset typeOffset, SFont.Underline underline)
      Description copied from interface: SRange
      Get font if exists or create font if not exists from the book of this range and return it.
      Specified by:
      getOrCreateFont in interface SRange
      Returns:
      font of the specified font metrics
    • refresh

      public void refresh(boolean includeDependants)
      Description copied from interface: SRange
      Evaluate(if not cached), update data model, and refresh UI of this range and its dependent cells if the includeDependents is true.
      Specified by:
      refresh in interface SRange
    • refresh

      public void refresh(boolean includeDependants, boolean clearCache, boolean enforceEval)
      Description copied from interface: SRange
      Update data model and refresh UI of this range and its dependent cells if the argument includeDependents is true. Note that when you set parameter clearCache to true, the cached formula result in data model will be cleared first. If you set parameter enforceEval to true, data model associated with this range will be evaluated immediately; otherwise will be evaluated on demand.
      Specified by:
      refresh in interface SRange
    • setAutoRefresh

      public boolean setAutoRefresh(boolean auto)
      Description copied from interface: SRange
      Turn on(true)/off(false) of auto refresh of this range and return previous on/off status; default is true.
      Specified by:
      setAutoRefresh in interface SRange
      Parameters:
      auto - whether refresh automatically
      Returns:
      previous status
    • setSheetVisible

      public void setSheetVisible(SRange.SheetVisible visible)
      Description copied from interface: SRange
      Set Sheet visibility; can be SheetVisible.VISIBLE, SheetVisible.HIDDEN, and SheetVisible.VERY_HIDDEN.
      • VISIBLE: the sheet is visible
      • HIDDEN: the sheet is hidden but can be unhidden using UI
      • VERY_HIDDEN: the sheet is hidden but can be unhidden only via this API.
      Specified by:
      setSheetVisible in interface SRange
      See Also:
    • setCommentRichText

      public void setCommentRichText(String html)
      Description copied from interface: SRange
      Set comment rich text into the left top cell of this range; null to delete it.
      Specified by:
      setCommentRichText in interface SRange
    • getCommentRichText

      public String getCommentRichText()
      Description copied from interface: SRange
      Return the comment rich edit text of the left top cell of this Range.
      Specified by:
      getCommentRichText in interface SRange
      Returns:
      the rich edit text of this Range.
    • setCommentVisible

      public void setCommentVisible(boolean visible)
      Description copied from interface: SRange
      Set comment visibility into the left top cell of this range; if no comment at the cell, it simply ignored.
      Specified by:
      setCommentVisible in interface SRange
    • isCommentVisible

      public boolean isCommentVisible()
      Description copied from interface: SRange
      Returns whether the comment is always visible at the left top cell of this range; if no comment at the cell, it returns false.
      Specified by:
      isCommentVisible in interface SRange
      Returns:
    • setNameName

      public void setNameName(String namename, String newname)
      Description copied from interface: SRange
      Set(Rename) the name of the Name(or Table) as specified in this Range(a Book or a Sheet).
      Specified by:
      setNameName in interface SRange
      Parameters:
      namename - name of the Name(or Table)
      newname - new name for the Name(or Table)
    • setStringValue

      public void setStringValue(String value)
      Description copied from interface: SRange
      Save the specified value into this range as a String no matter the value is prefixed with '=' or not.
      Specified by:
      setStringValue in interface SRange
    • getMergedRegion

      public CellRegion getMergedRegion()
      Description copied from interface: SRange
      Returns the merged region of the left top cell of this Range if any; otherwise, returns null if not a merged region.
      Specified by:
      getMergedRegion in interface SRange
      Returns:
      the merged region of the left top cell of this Range if any
    • getDataRegion

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

      public SSheet cloneSheetFrom(String name, SSheet sheet)
      Description copied from interface: SRange
      Clone from the specified source sheet to the owner book of this range. The book can be different between the owner book of this range and of the specified source sheet.
      Specified by:
      cloneSheetFrom in interface SRange
      Parameters:
      name - the name of the new created sheet; null would try to use the sheet name of the specified source sheet; if the same sheet name already used in the owner book of this range then use default "SheetX" name where X is the next sheet number of the owner book of this range.
      sheet - the source sheet to clone from to the owner book of this range.
      Returns:
      the new created sheet
      See Also:
    • cloneSheetFrom

      public SSheet cloneSheetFrom(String name, SSheet sheet, boolean valueOnly)
      Description copied from interface: SRange
      Clone from the specified source sheet to the owner book of this range. The book can be different between the owner book of this range and of the specified source sheet.
      Specified by:
      cloneSheetFrom in interface SRange
      Parameters:
      name - the name of the new created sheet; null would try to use the sheet name of the specified source sheet; if the same sheet name already used in the owner book of this range then use default "SheetX" name where X is the next sheet number of the owner book of this range.
      sheet - the source sheet to clone from to the owner book of this range.
      valueOnly - true to copy cell value only
      Returns:
      the new created sheet
    • getDirectPrecedents

      public Set<SRange> getDirectPrecedents()
      Description copied from interface: SRange
      Returns Range(s) that are the direct precedents of this cell Range. If this Range covers more than one cell, the left-top one is used.
      Specified by:
      getDirectPrecedents in interface SRange
      Returns:
      the direct precedents
    • getPrecedents

      public Set<SRange> getPrecedents()
      Description copied from interface: SRange
      Returns all Range(s) that are the direct or indirect precedents of this cell Range. If this Range covers more than one cell, the left-top one is used.
      Specified by:
      getPrecedents in interface SRange
      Returns:
      all direct or indirect precedents
    • getDirectDependents

      public Set<SRange> getDirectDependents()
      Description copied from interface: SRange
      Returns Range(s) that are the direct dependents of this cell Range. If this Range covers more than one cell, the left-top one is used.
      Specified by:
      getDirectDependents in interface SRange
      Returns:
      the direct dependents
    • getDependents

      public Set<SRange> getDependents()
      Description copied from interface: SRange
      Returns all Range(s) that are the direct or indirect dependents of this cell Range. If this Range covers more than one cell, the left-top one is used.
      Specified by:
      getDependents in interface SRange
      Returns:
      all direct or indirect dependents
    • group

      public void group()
      Description copied from interface: SRange
      Groups the rows or columns by matching the range, which increases their outline level.

      Note: The maximum level is up to 7.

      Specified by:
      group in interface SRange
    • ungroup

      public void ungroup()
      Description copied from interface: SRange
      Ungroups the rows or columns by matching the range, which decreases their outline level.

      Note: The minimum level is down to 0.

      Specified by:
      ungroup in interface SRange
    • getRowGroups

      public List<SRange> getRowGroups()
      Description copied from interface: SRange
      Returns all group ranges for rows, which intersect with this range.
      Specified by:
      getRowGroups in interface SRange
      Returns:
      an empty list if not matched.
    • getRowGroups

      public List<SRange> getRowGroups(int outlineLevel)
      Description copied from interface: SRange
      Returns all group ranges matched the given outline level for rows, which intersect with this range.
      Specified by:
      getRowGroups in interface SRange
      Parameters:
      outlineLevel - a valid value in a range is from 1 to 7 (inclusive).
      Returns:
      an empty list if not matched.
    • getRowGroups

      public List<SRange> getRowGroups(int fromOutlineLevel, int toOutlineLevel)
      Description copied from interface: SRange
      Returns all group ranges matched between fromOutlineLevel and toOutlineLevel for rows, which intersect with this range.
      Specified by:
      getRowGroups in interface SRange
      Parameters:
      fromOutlineLevel - 1~7 (inclusive)
      toOutlineLevel - 2~8 (exclusive)
      Returns:
      an empty list if not matched.
    • getColumnGroups

      public List<SRange> getColumnGroups()
      Description copied from interface: SRange
      Returns all group ranges for columns, which intersect with this range.
      Specified by:
      getColumnGroups in interface SRange
      Returns:
      an empty list if not matched.
    • getColumnGroups

      public List<SRange> getColumnGroups(int outlineLevel)
      Description copied from interface: SRange
      Returns all group ranges matched the given outline level for columns, which intersect with this range.
      Specified by:
      getColumnGroups in interface SRange
      Parameters:
      outlineLevel - a valid value in a range is from 1 to 7 (inclusive).
      Returns:
      an empty list if not matched.
    • getColumnGroups

      public List<SRange> getColumnGroups(int fromOutlineLevel, int toOutlineLevel)
      Description copied from interface: SRange
      Returns all group ranges matched between fromOutlineLevel and toOutlineLevel for columns, which intersect with this range.
      Specified by:
      getColumnGroups in interface SRange
      Parameters:
      fromOutlineLevel - 1~7 (inclusive)
      toOutlineLevel - 2~8 (exclusive)
      Returns:
      an empty list if not matched.
    • setSummaryBelow

      public void setSummaryBelow(boolean summaryBelow)
      Description copied from interface: SRange
      Sets to be true to display summary group as below or to be false to display summary group as above for rows.

      Note: One setting to affect whole sheet, if the value is up-side-down against the previous value, it will clear all outline level for rows and columns.

      Default: true

      Specified by:
      setSummaryBelow in interface SRange
      Parameters:
      summaryBelow - true to display as below for rows.
    • isSummaryBelow

      public boolean isSummaryBelow()
      Description copied from interface: SRange
      Returns whether to display group summary as below for rows.

      Default: true

      Specified by:
      isSummaryBelow in interface SRange
    • setSummaryRight

      public void setSummaryRight(boolean summaryRight)
      Description copied from interface: SRange
      Sets to be true to display summary group as right or to be false to display summary group as left for columns.

      Note: One setting to affect whole sheet, if the value is up-side-down against the previous value, it will clear all outline level for rows and columns.

      Default: true

      Specified by:
      setSummaryRight in interface SRange
      Parameters:
      summaryRight - true to display as right for columns.
    • isSummaryRight

      public boolean isSummaryRight()
      Description copied from interface: SRange
      Returns whether to display group summary as right for columns.

      Default: true

      Specified by:
      isSummaryRight in interface SRange
    • collapse

      public void collapse()
      Description copied from interface: SRange
      Collapses one group by matching with the 1st selected area of this Range in rows or columns. (not affected its descendant).
      Specified by:
      collapse in interface SRange
    • expand

      public void expand()
      Description copied from interface: SRange
      Expands one group by matching with the 1st selected area of this Range in rows or columns. (not affected its descendant).
      Specified by:
      expand in interface SRange
    • clearOutlineLevel

      public void clearOutlineLevel()
      Description copied from interface: SRange
      Clears all outline level for all groups that intersect with the range. 2:4 for rows and C:E for columns
      Specified by:
      clearOutlineLevel in interface SRange
    • isCollapsed

      public boolean isCollapsed()
      Description copied from interface: SRange
      Returns whether the group by matching with the 1st selected area of this Range in rows or columns, which has collapsed or not. Otherwise, returns false instead.
      Specified by:
      isCollapsed in interface SRange
    • getOutlineLevel

      public int getOutlineLevel()
      Description copied from interface: SRange
      Returns the outline level of the group by matching with the 1st selected area of this Range in rows or columns. Otherwise, returns 0 instead.
      Specified by:
      getOutlineLevel in interface SRange