Class Shortener


  • public class Shortener
    extends Object
    Class to provide access to the current worksheet with a shortened syntax
    Note: The WS object can be null if the workbook was created without a worksheet. The object will be available as soon as the current worksheet is defined
    Author:
    Raphael Stoeckli
    • Constructor Summary

      Constructors 
      Constructor Description
      Shortener()
      Default constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void down()
      Moves the cursor one row down
      void down​(int numberOfRows)
      Moves the cursor the number of defined rows down
      void formula​(String formula)
      Sets a formula into the current cell and moves the cursor to the next cell (column or row depending on the defined cell direction)
      void formula​(String formula, Style style)
      Sets a formula with style into the current cell and moves the cursor to the next cell (column or row depending on the defined cell direction)
      void right()
      Moves the cursor one column to the right
      void right​(int numberOfColumns)
      Moves the cursor the number of defined columns to the right
      void setCurrentWorksheet​(Worksheet worksheet)
      Sets the worksheet accessed by the shortener
      void value​(Object value)
      Sets a value into the current cell and moves the cursor to the next cell (column or row depending on the defined cell direction)
      void value​(Object value, Style style)
      Sets a value with style into the current cell and moves the cursor to the next cell (column or row depending on the defined cell direction)
    • Constructor Detail

      • Shortener

        public Shortener()
        Default constructor
    • Method Detail

      • setCurrentWorksheet

        public void setCurrentWorksheet​(Worksheet worksheet)
        Sets the worksheet accessed by the shortener
        Parameters:
        worksheet - Current worksheet
      • value

        public void value​(Object value)
        Sets a value into the current cell and moves the cursor to the next cell (column or row depending on the defined cell direction)
        Parameters:
        value - Value to set
        Throws:
        WorksheetException - Throws a WorksheetException if no worksheet was defined
      • value

        public void value​(Object value,
                          Style style)
        Sets a value with style into the current cell and moves the cursor to the next cell (column or row depending on the defined cell direction)
        Parameters:
        value - Value to set
        style - Style to set
        Throws:
        WorksheetException - Throws a WorksheetException if no worksheet was defined
      • formula

        public void formula​(String formula)
        Sets a formula into the current cell and moves the cursor to the next cell (column or row depending on the defined cell direction)
        Parameters:
        formula - Formula to set
        Throws:
        WorksheetException - Throws a WorksheetException if no worksheet was defined
      • formula

        public void formula​(String formula,
                            Style style)
        Sets a formula with style into the current cell and moves the cursor to the next cell (column or row depending on the defined cell direction)
        Parameters:
        formula - Formula to set
        style - Style to set
        Throws:
        WorksheetException - Throws a WorksheetException if no worksheet was defined
      • down

        public void down()
        Moves the cursor one row down
        Throws:
        WorksheetException - Throws a WorksheetException if no worksheet was defined
      • down

        public void down​(int numberOfRows)
        Moves the cursor the number of defined rows down
        Parameters:
        numberOfRows - Number of rows to move
        Throws:
        WorksheetException - Throws a WorksheetException if no worksheet was defined
      • right

        public void right()
        Moves the cursor one column to the right
        Throws:
        WorksheetException - Throws a WorksheetException if no worksheet was defined
      • right

        public void right​(int numberOfColumns)
        Moves the cursor the number of defined columns to the right
        Parameters:
        numberOfColumns - Number of columns to move
        Throws:
        WorksheetException - Throws a WorksheetException if no worksheet was defined