Package io.keikai.api

Class Ranges


  • public class Ranges
    extends java.lang.Object
    The facade class provides you multiple ways to get a Range.
    Since:
    3.0.0
    Author:
    dennis
    See Also:
    Range
    • Constructor Summary

      Constructors 
      Constructor Description
      Ranges()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getAreaRefString​(int tRow, int lCol, int bRow, int rCol)
      Gets area reference expression
      static java.lang.String getAreaRefString​(Sheet sheet, int tRow, int lCol, int bRow, int rCol)
      Gets area reference expression
      static java.lang.String getAreaRefString​(Sheet sheet, AreaRef area)
      Gets area reference expression
      static java.lang.String getCellRefString​(int row, int col)
      Gets cell reference expression
      static java.lang.String getCellRefString​(Sheet sheet, int row, int col)
      Gets cell reference expression string
      static java.lang.String getColumnRefString​(int column)
      Get column reference string
      static java.util.List<java.lang.String> getNames​(Sheet sheet)
      Returns a list of the defined names belong to the specified Sheet;
      static java.lang.String getRowRefString​(int row)
      Get row reference
      static Range range​(Book book)
      Returns the associated Range of the whole specified Book.
      static Range range​(Sheet sheet)
      Returns the associated Range of the whole specified Sheet.
      static Range range​(Sheet sheet, int row, int col)
      Returns the associated Range of the specified Sheet and cell row and column.
      static Range range​(Sheet sheet, int tRow, int lCol, int bRow, int rCol)
      Returns the associated XRange of the specified XSheet and area.
      static Range range​(Sheet sheet, AreaRef selection)
      Returns the associated Range of the specified Sheet and cell row and column.
      static Range range​(Sheet sheet, CellRegion cellRegion)
      Returns the associated Range of the specified Sheet and cell row and column.
      static Range range​(Sheet sheet, java.lang.String areaReference)
      Returns the associated Range of the specified Sheet and area reference string (e.g.
      static Range rangeByName​(Sheet sheet, java.lang.String name)
      Returns the associated Range of the specified name of a NamedRange (e.g.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Ranges

        public Ranges()
    • Method Detail

      • range

        public static Range range​(Sheet sheet)
        Returns the associated Range of the whole specified Sheet.
        Parameters:
        sheet - the Sheet the Range will refer to.
        Returns:
        the associated Range of the whole specified Sheet.
      • range

        public static Range range​(Sheet sheet,
                                  java.lang.String areaReference)
        Returns the associated Range of the specified Sheet and area reference string (e.g. "A1:D4" or "Sheet2!A1:D4") note that if reference string contains sheet name, the returned range will refer to the named sheet.
        Parameters:
        sheet - the Sheet the Range will refer to.
        reference - the area the Range will refer to (e.g. "A1:D4").
        Returns:
        the associated Range of the specified Sheet and area reference string (e.g. "A1:D4").
      • rangeByName

        public static Range rangeByName​(Sheet sheet,
                                        java.lang.String name)
        Returns the associated Range of the specified name of a NamedRange (e.g. "MyRange");
        Parameters:
        sheet - the Sheet the Range will refer to.
        name - the name of NamedRange (e.g. "MyRange"); .
        Returns:
        the associated Range of the specified name
      • getNames

        public static java.util.List<java.lang.String> getNames​(Sheet sheet)
        Returns a list of the defined names belong to the specified Sheet;
        Parameters:
        sheet - the Sheet the defined names will refer to.
        Returns:
        a list of the defined names of the specified sheet
        Since:
        5.1.0
      • range

        public static Range range​(Sheet sheet,
                                  int tRow,
                                  int lCol,
                                  int bRow,
                                  int rCol)
        Returns the associated XRange of the specified XSheet and area.
        Parameters:
        sheet - the Sheet the Range will refer to.
        tRow - top row index of the area the Range will refer to.
        lCol - left column index of the area the Range will refer to.
        bRow - bottom row index of the area the Range will refer to.
        rCol - right column index fo the area the Range will refer to.
        Returns:
        the associated Range of the specified Sheet and area.
      • range

        public static Range range​(Sheet sheet,
                                  int row,
                                  int col)
        Returns the associated Range of the specified Sheet and cell row and column.
        Parameters:
        sheet - the Sheet the Range will refer to.
        row - row index of the cell the Range will refer to.
        col - column index of the cell the Range will refer to.
        Returns:
        the associated Range of the specified Sheet and cell .
      • range

        public static Range range​(Sheet sheet,
                                  AreaRef selection)
        Returns the associated Range of the specified Sheet and cell row and column.
        Parameters:
        sheet - the Sheet the Range will refer to.
        selection - the selection of spreadsheet
      • range

        public static Range range​(Sheet sheet,
                                  CellRegion cellRegion)
        Returns the associated Range of the specified Sheet and cell row and column.
        Parameters:
        sheet - the Sheet the Range will refer to.
        cellRegion - the cell region
        Since:
        6.2.0
      • getCellRefString

        public static java.lang.String getCellRefString​(int row,
                                                        int col)
        Gets cell reference expression
        Parameters:
        row - 0-based row index
        col - 0-based column index
        Returns:
        the cell reference string (e.g. A1)
      • getCellRefString

        public static java.lang.String getCellRefString​(Sheet sheet,
                                                        int row,
                                                        int col)
        Gets cell reference expression string
        Parameters:
        sheet - sheet
        row - 0-based row index
        col - 0-based column index
        Returns:
        the cell reference string (e.g. Sheet1!A1)
      • getAreaRefString

        public static java.lang.String getAreaRefString​(int tRow,
                                                        int lCol,
                                                        int bRow,
                                                        int rCol)
        Gets area reference expression
        Parameters:
        tRow - top row
        lCol - left column
        bRow - bottom/last row
        rCol - right/last column
        Returns:
        the area reference string (e.g. A1:B2)
      • getAreaRefString

        public static java.lang.String getAreaRefString​(Sheet sheet,
                                                        int tRow,
                                                        int lCol,
                                                        int bRow,
                                                        int rCol)
        Gets area reference expression
        Parameters:
        sheet - sheet
        tRow - top row
        lCol - left column
        bRow - bottom row
        rCol - right column
        Returns:
        the area reference string (e.g. Sheet1!A1:B2)
      • getAreaRefString

        public static java.lang.String getAreaRefString​(Sheet sheet,
                                                        AreaRef area)
        Gets area reference expression
        Parameters:
        sheet - sheet
        area - area
        Returns:
        the area reference string (e.g. Sheet1!A1:B2)
      • getColumnRefString

        public static java.lang.String getColumnRefString​(int column)
        Get column reference string
        Parameters:
        column - 0-based column index
        Returns:
        the column reference string (e.g A, AB)
      • getRowRefString

        public static java.lang.String getRowRefString​(int row)
        Get row reference
        Parameters:
        row - 0-based row index
        Returns:
        the column reference string (e.g 1, 12)
      • range

        public static Range range​(Book book)
        Returns the associated Range of the whole specified Book.
        Parameters:
        book - the Book the Range will refer to.
        Returns:
        the associated Range of the whole specified Book.