|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.jett.util.FormulaUtil
public class FormulaUtil
The FormulaUtil utility class provides methods for Excel
formula creation and manipulation.
| Constructor Summary | |
|---|---|
FormulaUtil()
|
|
| Method Summary | |
|---|---|
static void |
copyCellReferencesInRange(java.lang.String sheetName,
java.util.Map<java.lang.String,java.util.List<CellRef>> cellRefMap,
int left,
int right,
int top,
int bottom,
int numCols,
int numRows,
java.lang.String currSuffix,
java.lang.String newSuffix)
Copies cell references that are on the same Sheet in the
given cell reference map by the given number of rows and/or columns
(usually one of those two will be zero). |
static java.util.Map<java.lang.String,java.util.List<CellRef>> |
createCellRefMap(java.util.Map<java.lang.String,Formula> formulaMap)
Finds unique cell references in all Formulas in the given
formula map. |
static java.lang.String |
createExcelFormulaString(java.lang.String formulaText,
Formula formula,
java.lang.String sheetName,
WorkbookContext context)
Replaces cell references in the given formula text with the translated cell references, and returns the formula string. |
static void |
findAndReplaceCellRanges(java.util.Map<java.lang.String,java.util.List<CellRef>> cellRefMap)
Examines all CellRefs in each List. |
static void |
shiftCellReferencesInRange(java.lang.String sheetName,
java.util.Map<java.lang.String,java.util.List<CellRef>> cellRefMap,
int left,
int right,
int top,
int bottom,
int numCols,
int numRows,
boolean remove,
boolean add)
Shifts all CellRefs that are in range and on the same
Sheet by the given number of rows and/or columns (usually
one of those two will be zero). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FormulaUtil()
| Method Detail |
|---|
public static java.util.Map<java.lang.String,java.util.List<CellRef>> createCellRefMap(java.util.Map<java.lang.String,Formula> formulaMap)
Formulas in the given
formula map.
formulaMap - A formula map.
Map of cell key strings to
Lists of CellRefs. Each List
is initialized to contain only one CellRef, the original
from the cell key string, e.g. "Sheet1!C2" => [Sheet1!C2]
public static java.lang.String createExcelFormulaString(java.lang.String formulaText,
Formula formula,
java.lang.String sheetName,
WorkbookContext context)
formulaText - The Formula text, e.g. "SUM(C2)".formula - The FormulaCellRefs.sheetName - The name of the Sheet on which the formula
exists.context - The WorkbookContext, for its access to the
cell reference map.
Cell.setCellFormula().public static void findAndReplaceCellRanges(java.util.Map<java.lang.String,java.util.List<CellRef>> cellRefMap)
CellRefs in each List. If a group
of CellRefs represent a linear range, horizontally or
vertically, then they are replaced with a CellRefRange.
cellRefMap - The cell reference map.
public static void shiftCellReferencesInRange(java.lang.String sheetName,
java.util.Map<java.lang.String,java.util.List<CellRef>> cellRefMap,
int left,
int right,
int top,
int bottom,
int numCols,
int numRows,
boolean remove,
boolean add)
CellRefs that are in range and on the same
Sheet by the given number of rows and/or columns (usually
one of those two will be zero). Modifies the Lists that are
the values of cellRefMap.
sheetName - The name of the Sheet on which to shift
cell references.cellRefMap - The Map of cell key strings, representing
original cell locations, to Lists of current
CellRefs.left - The 0-based index of the column on which to start shifting
cell references.right - The 0-based index of the column on which to end shifting
cell references.top - The 0-based index of the row on which to start shifting
cell references.bottom - The 0-based index of the row on which to end shifting
cell references.numCols - The number of columns to shift the cell reference (can be
negative).numRows - The number of rows to shift the cell reference (can be
negative).remove - Determines whether to remove the old cell reference,
resulting in a shift, or not to remove the old cell reference,
resulting in a copy.add - Determines whether to add the new cell reference, resulting in
a copy, or not to add the new cell reference, resulting in a shift.
public static void copyCellReferencesInRange(java.lang.String sheetName,
java.util.Map<java.lang.String,java.util.List<CellRef>> cellRefMap,
int left,
int right,
int top,
int bottom,
int numCols,
int numRows,
java.lang.String currSuffix,
java.lang.String newSuffix)
Sheet in the
given cell reference map by the given number of rows and/or columns
(usually one of those two will be zero). Modifies the Lists
that are the values of cellRefMap.
sheetName - The name of the Sheet on which to copy
references.cellRefMap - The Map of cell key strings, representing
original cell locations, to Lists of current
CellRefs.left - The 0-based index of the column on which to start shifting
cell references.right - The 0-based index of the column on which to end shifting
cell references.top - The 0-based index of the row on which to start shifting
cell references.bottom - The 0-based index of the row on which to end shifting
cell references.numCols - The number of columns to shift the cell reference (can be
negative).numRows - The number of rows to shift the cell reference (can be
negative).currSuffix - The current "[loop,iter]*" suffix we're already in.newSuffix - The new "[loop,iter]" suffix to add for new entries.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||