下面列出了org.apache.poi.ss.usermodel.FormulaError#isValidCode ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public static ErrorConstant valueOf(int errorCode) {
if (FormulaError.isValidCode(errorCode)) {
switch (FormulaError.forInt(errorCode)) {
case NULL: return NULL;
case DIV0: return DIV_0;
case VALUE: return VALUE;
case REF: return REF;
case NAME: return NAME;
case NUM: return NUM;
case NA: return NA;
default: break;
}
}
logger.log( POILogger.WARN, "Warning - unexpected error code (" + errorCode + ")");
return new ErrorConstant(errorCode);
}
/**
* Converts error codes to text. Handles non-standard error codes OK.
* For debug/test purposes (and for formatting error messages).
* @return the String representation of the specified Excel error code.
*/
public static String getText(int errorCode) {
if(FormulaError.isValidCode(errorCode)) {
return FormulaError.forInt(errorCode).getString();
}
// Give a special string, based on ~, to make clear this isn't a standard Excel error
return "~non~std~err(" + errorCode + ")~";
}
/** Creates new ErrPtg */
private ErrPtg(int errorCode) {
if(!FormulaError.isValidCode(errorCode)) {
throw new IllegalArgumentException("Invalid error code (" + errorCode + ")");
}
field_1_error_code = errorCode;
}
public String getText() {
if(FormulaError.isValidCode(_errorCode)) {
return FormulaError.forInt(_errorCode).getString();
}
return "unknown error code (" + _errorCode + ")";
}