com.ihr.xbrl.tools.excel

## Class ExcelSheetPoint

- java.lang.Object
- - com.ihr.xbrl.tools.excel.ExcelSheetPoint

- All Implemented Interfaces:
    SheetPoint

      public class ExcelSheetPoint
      extends java.lang.Object
      implements SheetPoint

  This class represents a cell in an HSSFSheet. It is easier operating with SheetPoints than operating with cells using the raw POI api.
  Author:
    Ignacio

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExcelSheetPoint(java.lang.String sheetPointer)` Creates a sheetPoint object from the format sheetName!
    `ExcelSheetPoint(java.lang.String name, org.apache.poi.ss.usermodel.Sheet sh, int row, short col)` Creates a sheetPoint object providing all parameters.
    `ExcelSheetPoint(java.lang.String name, org.apache.poi.ss.usermodel.Sheet sh, java.lang.String rowCol)` Creates a sheetPoint object providing all parameters.
    `ExcelSheetPoint(java.lang.String sheetPointer, org.apache.poi.ss.usermodel.Workbook wb)` Creates a sheetPoint object from a sheetPointer string of the following form: sheetName!

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ExcelSheetPoint` | `clone()` Clone.
    `ExcelSheetPoint` | `down()` Moves this SheetPoint to point to the cell that is below this cell.
    `ExcelSheetPoint` | `down(int n)` Moves this SheetPoint down n cells.
    `boolean` | `equals(java.lang.Object obj)` Equals.
    `ExcelRSCell` | `getCell()` Obtains the HSSFCell object corresponding to the cell name.
    `java.lang.String` | `getCellName()` Gets the cell name.
    `short` | `getCol()` Access to the column.
    `org.apache.poi.ss.usermodel.RichTextString` | `getContent()` Access to the value of the cell and returns an HSSFRichTextString.
    `boolean` | `getContentAsBoolean()` Access to the value in the cell pointed to by this object the value is converted to a boolean depending on the content type of the cell.
    `boolean` | `getContentAsBoolean(boolean exceptionsIfBlank, boolean exceptionsIfError)` Access to the value in the cell pointed to by this object the value is converted to a boolean depending on the content type of the cell.
    `boolean` | `getContentAsBoolean(boolean exceptionsIfBlank, boolean valueIfBlankAndException, boolean exceptionsIfError, boolean valueIfErrorAndException)` Access to the value in the cell pointed to by this object the value is converted to a boolean depending on the content type of the cell.
    `java.util.Date` | `getContentAsDate()` Access to the value in the cell pointed to by this object the value is converted to a Date depending on the content type of the cell.
    `java.lang.Double` | `getContentAsDouble()` Access to the value in the cell as a Double.
    `ExcelSheetPoint` | `getContentAsSheetPoint(org.apache.poi.ss.usermodel.Workbook wb)` obtains an ExcelSheetPoint class instance with a reference to the workbook passed in as parameter
    `java.lang.String` | `getContentAsString()` Access to the value in the cell pointed to by this object the value is converted to a string depending on the content type of the cell.
    `SheetPointFactory` | `getFactory()` Gets the factory.
    `org.apache.poi.ss.usermodel.Cell` | `getOrCreateCell()` Obtains the HSSFCell object or creates a new cell if it is not found in the HSSFSheet.
    `int` | `getRow()` Access to the row.
    `ExcelRSSheet` | `getSheet()` Access to the sheet for this SheetPoint.
    `java.lang.String` | `getSheetName()` Access to the sheet name.
    `org.apache.poi.ss.usermodel.CellStyle` | `getStyle()` Access to the style defined in the cell.
    `int` | `hashCode()`
    `ExcelSheetPoint` | `left()` Moves this SheetPoint to point to the cell that is on the left of this cell.
    `ExcelSheetPoint` | `left(int n)` Moves this SheetPoint to the left n cells.
    `ExcelSheetPoint` | `right()` Moves this SheetPoint to point to the cell that is on the right of this cell.
    `ExcelSheetPoint` | `right(int n)` Moves this SheetPoint to the right n cells.
    `void` | `setCol(short col)` Sets the column.
    `void` | `setRow(int row)` Sets the row.
    `java.lang.String` | `toString()` To string.
    `ExcelSheetPoint` | `up()` Moves this SheetPoint to point to the cell that is above this cell.
    `ExcelSheetPoint` | `up(int n)` Moves this SheetPoint up n cells.

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ExcelSheetPoint

          public ExcelSheetPoint(java.lang.String sheetPointer,
                         org.apache.poi.ss.usermodel.Workbook wb)
                          throws InvalidSheetPointException

      Creates a sheetPoint object from a sheetPointer string of the following form: sheetName!Xn or sheetName!name

      sheetName is the name of the sheet. It MUST exist
      X is the row name in letters. First row is A...
      n is the column number. First column is 1

      $ characters are ignored. Sheet1!$A$3 will be considered equivalent to Sheet1!A3

      The alternative format is based on a cell name (Range name). Cell names must exist at the time this object is created.

      wb is the HSSFWorkBook. if not indicated then the HSSFSheet of this object will be null and sheet name will be the empty string

      Parameters:
        `sheetPointer` - String
        `wb` - HSSFWorkbook where the sheetName exists.
      Throws:
        `InvalidSheetPointException` - if the sheetPointer string is not properly written

    - #### ExcelSheetPoint

          public ExcelSheetPoint(java.lang.String name,
                         org.apache.poi.ss.usermodel.Sheet sh,
                         int row,
                         short col)

      Creates a sheetPoint object providing all parameters.
      Parameters:
        `name` - String Sheet name
        `sh` - HSSFSheet object
        `row` - row number, first row is 0
        `col` - col number, first col is 0

    - #### ExcelSheetPoint

          public ExcelSheetPoint(java.lang.String sheetPointer)
                          throws InvalidSheetPointException

      Creates a sheetPoint object from the format sheetName!A1 where A is the column letter(s) and 1 is the row number

      This constructor does not resolve cell names and only works when the workbook or Sheet object is not required by the application.

      Use with care

      Parameters:
        `sheetPointer` - the sheet point
      Throws:
        `InvalidSheetPointException` - the invalid sheet point exception

    - #### ExcelSheetPoint

          public ExcelSheetPoint(java.lang.String name,
                         org.apache.poi.ss.usermodel.Sheet sh,
                         java.lang.String rowCol)
                          throws InvalidSheetPointException

      Creates a sheetPoint object providing all parameters.
      Parameters:
        `name` - String Sheet name
        `sh` - HSSFSheet object
        `rowCol` - row name and column name in A1 format
      Throws:
        `InvalidSheetPointException` - the invalid sheet point exception

  - ### Method Detail

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### equals

          public boolean equals(java.lang.Object obj)

      Description copied from interface: `SheetPoint`
      Equals.
      Specified by:
        `equals` in interface `SheetPoint`
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `obj` - the obj
      Returns:
        true, if successful

    - #### clone

          public ExcelSheetPoint clone()

      Description copied from interface: `SheetPoint`
      Clone.
      Specified by:
        `clone` in interface `SheetPoint`
      Overrides:
        `clone` in class `java.lang.Object`
      Returns:
        the sheet point

    - #### toString

          public java.lang.String toString()

      Description copied from interface: `SheetPoint`
      To string.
      Specified by:
        `toString` in interface `SheetPoint`
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        the string

    - #### getSheetName

          public java.lang.String getSheetName()

      Access to the sheet name.
      Specified by:
        `getSheetName` in interface `SheetPoint`
      Returns:
        String sheet name

    - #### getContentAsString

          public java.lang.String getContentAsString()
                                              throws SheetPointAccessException

      Access to the value in the cell pointed to by this object the value is converted to a string depending on the content type of the cell. If the cell content is not known then null is returned HSSFCell.BLANK cells returns the empty string HSSFCell.ERROR cells returns "Error" as a string
      Specified by:
        `getContentAsString` in interface `SheetPoint`
      Returns:
        String
      Throws:
        `SheetPointAccessException` - if there is no cell in the sheet

    - #### getContentAsBoolean

          public boolean getContentAsBoolean()
                                      throws SheetPointAccessException

      Access to the value in the cell pointed to by this object the value is converted to a boolean depending on the content type of the cell. If the cell type is unknown then an exception is raised HSSFCell.BLANK cells returns false HSSFCell.ERROR cells returns false HSSFCell.BOOLEAN cells returns the boolean value HSSFCell.NUMERIC cells returns true if the value is non zero HSSFCell.STRING cells returns the parsed string converted into a boolean value HSSFCell.FORMULA cells returns a value depending on the formula result type, in turn NUMERIC, STRING or BOOLEAN are equally handled
      Specified by:
        `getContentAsBoolean` in interface `SheetPoint`
      Returns:
        boolean
      Throws:
        `SheetPointAccessException` - if there is no cell in the sheet

    - #### getContentAsDate

          public java.util.Date getContentAsDate()
                                          throws SheetPointAccessException

      Access to the value in the cell pointed to by this object the value is converted to a Date depending on the content type of the cell. If the cell type is unknown then an exception is raised HSSFCell.BLANK cells returns new java.util.Date(0) HSSFCell.ERROR cells returns new java.util.Date(0) HSSFCell.BOOLEAN cells returns new java.util.Date(0) HSSFCell.NUMERIC cells returns a date from the Excel cell HSSFCell.STRING cells returns the parsed date of the Excel cell HSSFCell.FORMULA cells returns a value depending on the formula result type, only NUMERIC or STRING are handled
      Specified by:
        `getContentAsDate` in interface `SheetPoint`
      Returns:
        java.util.Date
      Throws:
        `SheetPointAccessException` - if there is no cell in the sheet

    - #### getContentAsBoolean

          public boolean getContentAsBoolean(boolean exceptionsIfBlank,
                                    boolean exceptionsIfError)
                                      throws SheetPointAccessException

      Access to the value in the cell pointed to by this object the value is converted to a boolean depending on the content type of the cell. If the cell type is unknown then an exception is raised HSSFCell.BLANK cells returns false HSSFCell.ERROR cells returns false HSSFCell.BOOLEAN cells returns the boolean value HSSFCell.NUMERIC cells returns true if the value is non zero HSSFCell.STRING cells returns the parsed string converted into a boolean value HSSFCell.FORMULA cells returns a value depending on the formula result type, in turn NUMERIC, STRING or BOOLEAN are equally handled
      Parameters:
        `exceptionsIfBlank` - if this parameter is true, the function will raise an exception if the cell is blank rather than return false which is the default
        `exceptionsIfError` - if this parameter is true, the function will raise an exception if the cell is an error rather than return false which is the default
      Returns:
        boolean
      Throws:
        `SheetPointAccessException` - if there is no cell in the sheet

    - #### getContentAsBoolean

          public boolean getContentAsBoolean(boolean exceptionsIfBlank,
                                    boolean valueIfBlankAndException,
                                    boolean exceptionsIfError,
                                    boolean valueIfErrorAndException)
                                      throws SheetPointAccessException

      Access to the value in the cell pointed to by this object the value is converted to a boolean depending on the content type of the cell. If the cell type is unknown then an exception is raised HSSFCell.BLANK cells returns false HSSFCell.ERROR cells returns false HSSFCell.BOOLEAN cells returns the boolean value HSSFCell.NUMERIC cells returns true if the value is non zero HSSFCell.STRING cells returns the parsed string converted into a boolean value HSSFCell.FORMULA cells returns a value depending on the formula result type, in turn NUMERIC, STRING or BOOLEAN are equally handled
      Parameters:
        `exceptionsIfBlank` - if this parameter is true, the function will raise an exception if the cell is blank rather than return the value of the valueIfBlankAndException parameter
        `valueIfBlankAndException` - this is the value returned in case the cell is blank and exceptions are not reported
        `exceptionsIfError` - if this parameter is true, the function will raise an exception if the cell is an error rather than return the value of the valueIfErrorAndException parameter
        `valueIfErrorAndException` - this is the value returned in case the cell contains an error and exceptions are not reported
      Returns:
        boolean
      Throws:
        `SheetPointAccessException` - there is a IllegalStateException or NumberFormatException

    - #### getContentAsDouble

          public java.lang.Double getContentAsDouble()
                                              throws SheetPointAccessException

      Access to the value in the cell as a Double.
      Specified by:
        `getContentAsDouble` in interface `SheetPoint`
      Returns:
        Double
      Throws:
        `SheetPointAccessException` - if there is no cell in the sheet

    - #### getContent

          public org.apache.poi.ss.usermodel.RichTextString getContent()
                                                                throws SheetPointAccessException

      Access to the value of the cell and returns an HSSFRichTextString.
      Returns:
        HSSFRichTextString
      Throws:
        `SheetPointAccessException` - if there is no cell in the sheet

    - #### getStyle

          public org.apache.poi.ss.usermodel.CellStyle getStyle()
                                                         throws SheetPointAccessException

      Access to the style defined in the cell.
      Returns:
        HSSFCellStyle
      Throws:
        `SheetPointAccessException` - the sheet point access exception

    - #### getCell

          public ExcelRSCell getCell()
                              throws SheetPointAccessException

      Obtains the HSSFCell object corresponding to the cell name.
      Specified by:
        `getCell` in interface `SheetPoint`
      Returns:
        HSSFCell
      Throws:
        `SheetPointAccessException` - if the row or the column does not exists

    - #### getOrCreateCell

          public org.apache.poi.ss.usermodel.Cell getOrCreateCell()

      Obtains the HSSFCell object or creates a new cell if it is not found in the HSSFSheet.
      Returns:
        HSSFCell

    - #### getSheet

          public ExcelRSSheet getSheet()

      Access to the sheet for this SheetPoint.
      Specified by:
        `getSheet` in interface `SheetPoint`
      Returns:
        HSSFSheet

    - #### getRow

          public int getRow()

      Access to the row.
      Specified by:
        `getRow` in interface `SheetPoint`
      Returns:
        int

    - #### getCol

          public short getCol()

      Access to the column.
      Specified by:
        `getCol` in interface `SheetPoint`
      Returns:
        short

    - #### getCellName

          public java.lang.String getCellName()

      Gets the cell name.
      Specified by:
        `getCellName` in interface `SheetPoint`
      Returns:
        the cellName

    - #### setRow

          public void setRow(int row)

      Sets the row.
      Parameters:
        `row` - int new value

    - #### setCol

          public void setCol(short col)

      Sets the column.
      Parameters:
        `col` - short new value

    - #### up

          public ExcelSheetPoint up()

      Moves this SheetPoint to point to the cell that is above this cell.
      Returns:
        the excel sheet point

    - #### up

          public ExcelSheetPoint up(int n)

      Moves this SheetPoint up n cells.
      Specified by:
        `up` in interface `SheetPoint`
      Parameters:
        `n` - the n
      Returns:
        SheetPoint

    - #### down

          public ExcelSheetPoint down()

      Moves this SheetPoint to point to the cell that is below this cell.
      Returns:
        the excel sheet point

    - #### down

          public ExcelSheetPoint down(int n)

      Moves this SheetPoint down n cells.
      Specified by:
        `down` in interface `SheetPoint`
      Parameters:
        `n` - the n
      Returns:
        SheetPoint

    - #### left

          public ExcelSheetPoint left()

      Moves this SheetPoint to point to the cell that is on the left of this cell.
      Returns:
        the excel sheet point

    - #### left

          public ExcelSheetPoint left(int n)

      Moves this SheetPoint to the left n cells.
      Specified by:
        `left` in interface `SheetPoint`
      Parameters:
        `n` - the n
      Returns:
        SheetPoint

    - #### right

          public ExcelSheetPoint right()

      Moves this SheetPoint to point to the cell that is on the right of this cell.
      Returns:
        the excel sheet point

    - #### right

          public ExcelSheetPoint right(int n)

      Moves this SheetPoint to the right n cells.
      Specified by:
        `right` in interface `SheetPoint`
      Parameters:
        `n` - the n
      Returns:
        SheetPoint

    - #### getFactory

          public SheetPointFactory getFactory()

      Description copied from interface: `SheetPoint`
      Gets the factory.
      Specified by:
        `getFactory` in interface `SheetPoint`
      Returns:
        the factory

    - #### getContentAsSheetPoint

          public ExcelSheetPoint getContentAsSheetPoint(org.apache.poi.ss.usermodel.Workbook wb)
                                                 throws InvalidSheetPointException,
                                                        SheetPointAccessException

      obtains an ExcelSheetPoint class instance with a reference to the workbook passed in as parameter
      Parameters:
        `wb` - the workbook to create an ExcelSheetPoint to
      Returns:
        instance of the ExcelSheetPoint
      Throws:
        `InvalidSheetPointException`
        `SheetPointAccessException`