Package io.keikai.api

Class Ranges


  • public class Ranges
    extends Object
    The facade class provides you multiple ways to get a Range.
    Since:
    3.0.0
    Author:
    dennis
    See Also:
    Range
    • 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,
                                  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,
                                        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 List<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
      • getCellRefString

        public static 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 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 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 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 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 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 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.