@Internal public final class WorkbookEvaluator extends java.lang.Object
clearAllCachedResultValues()
if any workbook cells are changed between calls to evaluate~ methods on this class.
Constructor and Description |
---|
WorkbookEvaluator(EvaluationWorkbook workbook, IStabilityClassifier stabilityClassifier, UDFFinder udfFinder) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
adjustRegionRelativeReference(Ptg[] ptgs, CellReference target, CellRangeAddressBase region)
Adjust formula relative references by the offset between the start of the given region and the given target cell.
(通过给定区域的起点和给定目标单元格之间的偏移量调整公式相对引用。)
|
void |
clearAllCachedResultValues()
Should be called whenever there are changes to input cells in the evaluated workbook.
(每当评估工作簿中的输入单元格发生更改时,都应该调用它。)
|
static ValueEval |
dereferenceResult(ValueEval evaluationResult, int srcRowNum, int srcColNum)
Dereferences a single value from any AreaEval or RefEval evaluation result.
(从任何 AreaEval 或 RefEval 评估结果中取消引用单个值。)
|
ValueEval |
evaluate(EvaluationCell srcCell) |
ValueEval |
evaluate(java.lang.String formula, CellReference ref)
Evaluate a formula outside a cell value, e.g.
(评估单元格值之外的公式,例如)
|
ValueEval |
evaluate(java.lang.String formula, CellReference target, CellRangeAddressBase region)
Some expressions need to be evaluated in terms of an offset from the top left corner of a region, such as some data validation and conditional format expressions, when those constraints apply to contiguous cells.
(当这些约束应用于连续单元格时,需要根据与区域左上角的偏移量来评估某些表达式,例如某些数据验证和条件格式表达式。)
|
ValueEval |
evaluateList(java.lang.String formula, CellReference target, CellRangeAddressBase region)
Some expressions need to be evaluated in terms of an offset from the top left corner of a region, such as some data validation and conditional format expressions, when those constraints apply to contiguous cells.
(当这些约束应用于连续单元格时,需要根据与区域左上角的偏移量来评估某些表达式,例如某些数据验证和条件格式表达式。)
|
FreeRefFunction |
findUserDefinedFunction(java.lang.String functionName) |
static java.util.Collection<java.lang.String> |
getNotSupportedFunctionNames()
Return a collection of functions that POI does not support
(返回 POI 不支持的函数集合)
|
static java.util.Collection<java.lang.String> |
getSupportedFunctionNames()
Return a collection of functions that POI can evaluate
(返回 POI 可以评估的函数集合)
|
boolean |
isDebugEvaluationOutputForNextEval() |
boolean |
isIgnoreMissingWorkbooks() |
void |
notifyDeleteCell(EvaluationCell cell)
Should be called to tell the cell value cache that the specified cell has just been deleted.
(应该调用来告诉单元格值缓存指定的单元格刚刚被删除。)
|
void |
notifyUpdateCell(EvaluationCell cell)
Should be called to tell the cell value cache that the specified (value or formula) cell has changed.
(应该调用以告诉单元格值缓存指定的(值或公式)单元格已更改。)
|
static void |
registerFunction(java.lang.String name, FreeRefFunction func)
Register a ATP function in runtime.
(在运行时注册一个 ATP 函数。)
|
static void |
registerFunction(java.lang.String name, Function func)
Register a function in runtime.
(在运行时注册一个函数。)
|
void |
setDebugEvaluationOutputForNextEval(boolean value) |
void |
setIgnoreMissingWorkbooks(boolean ignore)
Whether to ignore missing references to external workbooks and use cached formula results in the main workbook instead.
(是否忽略对外部工作簿的缺失引用并在主工作簿中使用缓存的公式结果。)
|
public WorkbookEvaluator(EvaluationWorkbook workbook, IStabilityClassifier stabilityClassifier, UDFFinder udfFinder)
udfFinder
- pass
null
for default (AnalysisToolPak only)
(udfFinder - 传递 null 为默认值(仅限AnalysisToolPak))
public void clearAllCachedResultValues()
public void notifyUpdateCell(EvaluationCell cell)
public void notifyDeleteCell(EvaluationCell cell)
public ValueEval evaluate(EvaluationCell srcCell)
public static ValueEval dereferenceResult(ValueEval evaluationResult, int srcRowNum, int srcColNum)
NumberEval
,
StringEval
,
BoolEval
, or
ErrorEval
. Never
null
.
BlankEval
is converted to
NumberEval.ZERO
(NumberEval、StringEval、BoolEval 或 ErrorEval。从不为空。 BlankEval 转换为 NumberEval.ZERO)
public FreeRefFunction findUserDefinedFunction(java.lang.String functionName)
public ValueEval evaluate(java.lang.String formula, CellReference ref)
formula
- to evaluate
(公式 - 评估)
ref
- defines the optional sheet and row/column base for the formula, if it is relative
(ref - 定义公式的可选工作表和行/列基础,如果它是相对的)
public ValueEval evaluate(java.lang.String formula, CellReference target, CellRangeAddressBase region)
Returns a single value e.g. a cell formula result or boolean value for conditional formatting.
(当这些约束应用于连续单元格时,需要根据与区域左上角的偏移量来评估某些表达式,例如某些数据验证和条件格式表达式。当使用相对公式时,它必须通过移动相对于范围左上角的目标偏移位置来计算。返回单个值,例如单元格公式结果或用于条件格式的布尔值。)formula
- The formula to evaluate
(公式 - 要评估的公式)
target
- cell context for the operation
(target - 操作的单元格上下文)
region
- containing the cell
(region - 包含单元格)
java.lang.IllegalArgumentException
- if target does not define a sheet name to evaluate the formula on.
(java.lang.IllegalArgumentException - 如果 target 没有定义工作表名称来评估公式。)
public ValueEval evaluateList(java.lang.String formula, CellReference target, CellRangeAddressBase region)
Returns a ValueEval that may be one or more values, such as the allowed values for a data validation constraint.
(当这些约束应用于连续单元格时,需要根据与区域左上角的偏移量来评估某些表达式,例如某些数据验证和条件格式表达式。当使用相对公式时,它必须通过移动相对于范围左上角的目标偏移位置来计算。返回一个可能是一个或多个值的 ValueEval,例如数据验证约束的允许值。)formula
- The formula to evaluate
(公式 - 要评估的公式)
target
- cell context for the operation
(target - 操作的单元格上下文)
region
- containing the cell
(region - 包含单元格)
java.lang.IllegalArgumentException
- if target does not define a sheet name to evaluate the formula on.
(java.lang.IllegalArgumentException - 如果 target 没有定义工作表名称来评估公式。)
protected boolean adjustRegionRelativeReference(Ptg[] ptgs, CellReference target, CellRangeAddressBase region)
formula ref + range top-left + current cell range offsetwhich simplifies to
formula ref + current cell ref(通过给定区域的起点和给定目标单元格之间的偏移量调整公式相对引用。即,将区域左上角单元格视为“A1”,以评估相对参考组件(行和/或列),并通过区域内目标的位置进一步移动参考。公式参考 + 范围左上角 + 当前单元格范围偏移,简化为公式参考 + 当前单元格参考)
ptgs
-
(ptgs -)
target
- cell within the region to use.
(target - 要使用的区域内的单元格。)
region
- containing the cell, OR, for conditional format rules with multiple ranges, the region with the top-left-most cell
(region - 包含单元格,OR,对于具有多个范围的条件格式规则,具有最左上角单元格的区域)
java.lang.IndexOutOfBoundsException
- if the resulting shifted row/column indexes are over the document format limits
(java.lang.IndexOutOfBoundsException - 如果生成的移位行/列索引超出文档格式限制)
java.lang.IllegalArgumentException
- if target is not within region.
(java.lang.IllegalArgumentException - 如果目标不在区域内。)
public void setIgnoreMissingWorkbooks(boolean ignore)
In some cases exetrnal workbooks referenced by formulas in the main workbook are not avaiable. With this method you can control how POI handles such missing references:
CollaboratingWorkbooksEnvironment.WorkbookNotFoundException
if an external reference cannot be resolvedignore
- whether to ignore missing references to external workbooks
(ignore - 是否忽略对外部工作簿的缺失引用)
public boolean isIgnoreMissingWorkbooks()
public static java.util.Collection<java.lang.String> getSupportedFunctionNames()
public static java.util.Collection<java.lang.String> getNotSupportedFunctionNames()
public static void registerFunction(java.lang.String name, FreeRefFunction func)
name
- the function name
(name - 函数名)
func
- the functoin to register
(func - 要注册的函数)
java.lang.IllegalArgumentException
- if the function is unknown or already registered.
(java.lang.IllegalArgumentException - 如果函数未知或已注册。)
public static void registerFunction(java.lang.String name, Function func)
name
- the function name
(name - 函数名)
func
- the functoin to register
(func - 要注册的函数)
java.lang.IllegalArgumentException
- if the function is unknown or already registered.
(java.lang.IllegalArgumentException - 如果函数未知或已注册。)
public void setDebugEvaluationOutputForNextEval(boolean value)
public boolean isDebugEvaluationOutputForNextEval()
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.