jxl

Class CellReferenceHelper


public final class CellReferenceHelper
extends java.lang.Object

Exposes some cell reference helper methods to the public interface. This class merely delegates to the internally used reference helper

Method Summary

static void
getCellReference(int column, boolean colabs, int row, boolean rowabs, StringBuffer buf)
Overloaded method which prepends $ for absolute reference
static String
getCellReference(int column, int row)
Gets the cell reference for the specified column and row
static void
getCellReference(int column, int row, StringBuffer buf)
Appends the cell reference for the column and row passed in to the string buffer
static void
getCellReference(int sheet, int column, boolean colabs, int row, boolean rowabs, Workbook workbook, StringBuffer buf)
Gets the fully qualified cell reference given the column, row external sheet reference etc
static String
getCellReference(int sheet, int column, int row, Workbook workbook)
Gets the fully qualified cell reference given the column, row external sheet reference etc
static void
getCellReference(int sheet, int column, int row, Workbook workbook, StringBuffer buf)
Gets the fully qualified cell reference given the column, row external sheet reference etc
static String
getCellReference(int sheet, int column, int row, WritableWorkbook workbook)
Gets the fully qualified cell reference given the column, row external sheet reference etc
static void
getCellReference(int sheet, int column, int row, WritableWorkbook workbook, StringBuffer buf)
Gets the fully qualified cell reference given the column, row external sheet reference etc
static int
getColumn(String s)
Gets the columnn number of the string cell reference
static String
getColumnReference(int c)
Gets the column letter corresponding to the 0-based column number
static int
getRow(String s)
Gets the row number of the cell reference
static String
getSheet(String ref)
Gets the sheet name from the cell reference string
static boolean
isColumnRelative(String s)
Sees if the column component is relative or not
static boolean
isRowRelative(String s)
Sees if the row component is relative or not

Method Details

getCellReference

public static void getCellReference(int column,
                                    boolean colabs,
                                    int row,
                                    boolean rowabs,
                                    StringBuffer buf)
Overloaded method which prepends $ for absolute reference
Parameters:
column - the column number
colabs - TRUE if the column reference is absolute
row - the row number
rowabs - TRUE if the row reference is absolute
buf - the string buffer

getCellReference

public static String getCellReference(int column,
                                      int row)
Gets the cell reference for the specified column and row
Parameters:
column - the column
row - the row
Returns:
the cell reference

getCellReference

public static void getCellReference(int column,
                                    int row,
                                    StringBuffer buf)
Appends the cell reference for the column and row passed in to the string buffer
Parameters:
column - the column
row - the row
buf - the string buffer to append

getCellReference

public static void getCellReference(int sheet,
                                    int column,
                                    boolean colabs,
                                    int row,
                                    boolean rowabs,
                                    Workbook workbook,
                                    StringBuffer buf)
Gets the fully qualified cell reference given the column, row external sheet reference etc
Parameters:
sheet - the sheet
column - the column
colabs - TRUE if the column is an absolute reference
row - the row
rowabs - TRUE if the row is an absolute reference
workbook - the workbook
buf - the string buffer

getCellReference

public static String getCellReference(int sheet,
                                      int column,
                                      int row,
                                      Workbook workbook)
Gets the fully qualified cell reference given the column, row external sheet reference etc
Parameters:
sheet - the sheet
column - the column
row - the row
workbook - the workbook
Returns:
the cell reference in the form 'Sheet 1'!A1

getCellReference

public static void getCellReference(int sheet,
                                    int column,
                                    int row,
                                    Workbook workbook,
                                    StringBuffer buf)
Gets the fully qualified cell reference given the column, row external sheet reference etc
Parameters:
sheet - the sheet index
column - the column index
row - the row index
workbook - the workbook
buf - a string buffer

getCellReference

public static String getCellReference(int sheet,
                                      int column,
                                      int row,
                                      WritableWorkbook workbook)
Gets the fully qualified cell reference given the column, row external sheet reference etc
Parameters:
sheet - the sheet
column - the column
row - the row
workbook - the workbook
Returns:
the cell reference in the form 'Sheet 1'!A1

getCellReference

public static void getCellReference(int sheet,
                                    int column,
                                    int row,
                                    WritableWorkbook workbook,
                                    StringBuffer buf)
Gets the fully qualified cell reference given the column, row external sheet reference etc
Parameters:
sheet - the sheet
column - the column
row - the row
workbook - the workbook
buf - the buffer

getColumn

public static int getColumn(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

getColumnReference

public static String getColumnReference(int c)
Gets the column letter corresponding to the 0-based column number
Parameters:
c - the column number
Returns:
the letter for that column number

getRow

public static int getRow(String s)
Gets the row number of the cell reference
Parameters:
s - the cell reference
Returns:
the row number

getSheet

public static String getSheet(String ref)
Gets the sheet name from the cell reference string
Parameters:
ref - the cell reference
Returns:
the sheet name

isColumnRelative

public static boolean isColumnRelative(String s)
Sees if the column component is relative or not
Parameters:
s - the cell
Returns:
TRUE if the column is relative, FALSE otherwise

isRowRelative

public static boolean isRowRelative(String s)
Sees if the row component is relative or not
Parameters:
s - the cell
Returns:
TRUE if the row is relative, FALSE otherwise