public class SpreadsheetUtil extends Object implements Serializable
| Constructor and Description |
|---|
SpreadsheetUtil() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
cellContainsDate(org.apache.poi.ss.usermodel.Cell cell)
Determines whether the given cell contains a date or not.
|
static List<org.apache.poi.ss.util.CellReference> |
getAllReferencedCells(String formula,
Spreadsheet spreadsheet,
boolean includeHiddenCells)
This function returns all the cells that the given formula references.
|
static String |
getColHeader(int columnIndex)
Generates the column header for column with the given index
|
static int |
getColHeaderIndex(String header)
Returns the column index for the column with the given header.
|
static int |
getColumnIndexFromKey(String key)
Returns the column index for the given Cell key.
|
static int |
getFirstVisibleSheetPOIIndex(org.apache.poi.ss.usermodel.Workbook workbook)
Returns the POI index of the first visible sheet (not hidden or very
hidden).
|
static int |
getNumberOfVisibleSheets(org.apache.poi.ss.usermodel.Workbook workbook)
Returns the number of visible sheets (not hidden or very hidden) in the
given Workbook.
|
static org.apache.poi.ss.util.CellRangeAddress |
getRangeForReference(String formula,
Spreadsheet spreadsheet,
boolean includeHiddenCells)
evaluate the formula (which may just be a single cell or range string)
and find the bounding rectangle for the referenced cells.
|
static int |
getRowFromKey(String key)
Returns the row index for the given Cell key.
|
static boolean |
isCellInRange(org.apache.poi.ss.util.CellReference cellReference,
org.apache.poi.ss.util.CellRangeAddress cellRange)
Determines whether the given cell is within the given range.
|
static boolean |
needsLeadingQuote(org.apache.poi.ss.usermodel.Cell cell)
Determine if the given cell content should be displayed with a leading
quote in both cell editor and formula bar
|
static Double |
parseNumber(org.apache.poi.ss.usermodel.Cell cell,
String value,
Locale locale) |
static Double |
parseNumber(String cellContent,
Locale locale) |
static Double |
parsePercentage(String cellContent,
Locale locale)
Tries to parse the given String to a percentage.
|
static org.apache.poi.ss.util.CellReference |
relativeToAbsolute(Spreadsheet sheet,
org.apache.poi.ss.util.CellReference cell) |
static String |
toKey(org.apache.poi.ss.usermodel.Cell cell)
Translates cell coordinates from the given Cell object to a cell key used
to identify cells in the server-client communication.
|
static String |
toKey(int col,
int row)
Translates cell coordinates to a cell key used to identify cells in the
server-client communication.
|
public static final String toKey(int col, int row)
col - Column index, 1-basedrow - Row index 1-basedpublic static final String toKey(org.apache.poi.ss.usermodel.Cell cell)
cell - Cell to fetch the coordinates frompublic static boolean cellContainsDate(org.apache.poi.ss.usermodel.Cell cell)
cell - Cell to examinepublic static org.apache.poi.ss.util.CellReference relativeToAbsolute(Spreadsheet sheet, org.apache.poi.ss.util.CellReference cell)
public static String getColHeader(int columnIndex)
columnIndex - Index of column, 1-basedpublic static int getColHeaderIndex(String header)
header - Column headerpublic static boolean isCellInRange(org.apache.poi.ss.util.CellReference cellReference,
org.apache.poi.ss.util.CellRangeAddress cellRange)
cellReference - Target cell referencecellRange - Cell range to checkpublic static int getFirstVisibleSheetPOIIndex(org.apache.poi.ss.usermodel.Workbook workbook)
workbook - Workbook to get the sheets frompublic static int getNumberOfVisibleSheets(org.apache.poi.ss.usermodel.Workbook workbook)
workbook - Workbook to get the sheets frompublic static int getColumnIndexFromKey(String key)
key - Cell keypublic static int getRowFromKey(String key)
key - Cell keypublic static Double parsePercentage(String cellContent, Locale locale)
cellContent - The string to be parsedlocale - The current locale, used for number parsing.null if the
number can't be parsed as a decimal.public static Double parseNumber(org.apache.poi.ss.usermodel.Cell cell, String value, Locale locale)
public static boolean needsLeadingQuote(org.apache.poi.ss.usermodel.Cell cell)
cell - The cell to be checkedpublic static org.apache.poi.ss.util.CellRangeAddress getRangeForReference(String formula, Spreadsheet spreadsheet, boolean includeHiddenCells)
formula - spreadsheet - includeHiddenCells - public static List<org.apache.poi.ss.util.CellReference> getAllReferencedCells(String formula, Spreadsheet spreadsheet, boolean includeHiddenCells)
formula - The formula to find referenced cells forspreadsheet - Spreadsheet to operate onincludeHiddenCells - true to include cells residing in hidden rows or
columns, false to omit themCopyright © 2013–2026 Vaadin Ltd. All rights reserved.