jxl.biff
Class CellReferenceHelper

java.lang.Object
  extended byjxl.biff.CellReferenceHelper

public final class CellReferenceHelper
extends java.lang.Object

A helper to transform between excel cell references and sheet:column:row notation Because this function will be called when generating a string representation of a formula, the cell reference will merely be appened to the string buffer instead of returning a full blooded string, for performance reasons


Method Summary
static void getCellReference(int column, boolean colabs, int row, boolean rowabs, java.lang.StringBuffer buf)
          Overloaded method which prepends $ for absolute reference
static java.lang.String getCellReference(int column, int row)
          Gets the cell reference for the specified column and row
static void getCellReference(int sheet, int column, boolean colabs, int row, boolean rowabs, ExternalSheet workbook, java.lang.StringBuffer buf)
          Gets the fully qualified cell reference given the column, row external sheet reference etc
static java.lang.String getCellReference(int sheet, int column, int row, ExternalSheet workbook)
          Gets the fully qualified cell reference given the column, row external sheet reference etc
static void getCellReference(int sheet, int column, int row, ExternalSheet workbook, java.lang.StringBuffer buf)
          Gets the fully qualified cell reference given the column, row external sheet reference etc
static void getCellReference(int column, int row, java.lang.StringBuffer buf)
          Gets the cell reference
static int getColumn(java.lang.String s)
          Gets the columnn number of the string cell reference
static java.lang.String getColumnReference(int column)
          Gets the column letter corresponding to the 0-based column number
static void getColumnReference(int column, java.lang.StringBuffer buf)
          Gets the column letter corresponding to the 0-based column number
static int getRow(java.lang.String s)
          Gets the row number of the cell reference
static java.lang.String getSheet(java.lang.String ref)
          Gets the sheet name from the cell reference string
static boolean isColumnRelative(java.lang.String s)
          Sees if the column component is relative or not
static boolean isRowRelative(java.lang.String s)
          Sees if the row component is relative or not
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCellReference

public static void getCellReference(int column,
                                    int row,
                                    java.lang.StringBuffer buf)
Gets the cell reference

Parameters:
column -
row -
buf -

getCellReference

public static void getCellReference(int column,
                                    boolean colabs,
                                    int row,
                                    boolean rowabs,
                                    java.lang.StringBuffer buf)
Overloaded method which prepends $ for absolute reference

Parameters:
column -
colabs - TRUE if the column reference is absolute
row -
rowabs - TRUE if the row reference is absolute
buf -

getColumnReference

public static java.lang.String getColumnReference(int column)
Gets the column letter corresponding to the 0-based column number

Parameters:
column - the column number
Returns:
the letter for that column number

getColumnReference

public static void getColumnReference(int column,
                                      java.lang.StringBuffer buf)
Gets the column letter corresponding to the 0-based column number

Parameters:
column - the column number
buf - the string buffer in which to write the column letter

getCellReference

public static void getCellReference(int sheet,
                                    int column,
                                    int row,
                                    ExternalSheet workbook,
                                    java.lang.StringBuffer buf)
Gets the fully qualified cell reference given the column, row external sheet reference etc

Parameters:
sheet -
column -
row -
workbook -
buf -

getCellReference

public static void getCellReference(int sheet,
                                    int column,
                                    boolean colabs,
                                    int row,
                                    boolean rowabs,
                                    ExternalSheet workbook,
                                    java.lang.StringBuffer buf)
Gets the fully qualified cell reference given the column, row external sheet reference etc

Parameters:
sheet -
column -
colabs - TRUE if the column is an absolute reference
row -
rowabs - TRUE if the row is an absolute reference
workbook -
buf -

getCellReference

public static java.lang.String getCellReference(int sheet,
                                                int column,
                                                int row,
                                                ExternalSheet workbook)
Gets the fully qualified cell reference given the column, row external sheet reference etc

Parameters:
sheet -
column -
row -
workbook -
Returns:
the cell reference in the form 'Sheet 1'!A1

getCellReference

public static java.lang.String getCellReference(int column,
                                                int row)
Gets the cell reference for the specified column and row

Parameters:
column -
row -
Returns:

getColumn

public static int getColumn(java.lang.String s)
Gets the columnn number of the string cell reference

Parameters:
s - the string to parse
Returns:
the column portion of the cell reference

getRow

public static int getRow(java.lang.String s)
Gets the row number of the cell reference


isColumnRelative

public static boolean isColumnRelative(java.lang.String s)
Sees if the column component is relative or not

Parameters:
s -
Returns:
TRUE if the column is relative, FALSE otherwise

isRowRelative

public static boolean isRowRelative(java.lang.String s)
Sees if the row component is relative or not

Parameters:
s -
Returns:
TRUE if the row is relative, FALSE otherwise

getSheet

public static java.lang.String getSheet(java.lang.String ref)
Gets the sheet name from the cell reference string

Parameters:
ref -
Returns:
the sheet reference