org.apache.poi.ss.usermodel.FormulaError#forInt ( )源码实例Demo

下面列出了org.apache.poi.ss.usermodel.FormulaError#forInt ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: lams   文件: ErrorConstant.java
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);
}
 
源代码2 项目: lams   文件: ErrorEval.java
/**
 * Translates an Excel internal error code into the corresponding POI ErrorEval instance
 * @param errorCode An error code listed in {@link FormulaError}
 * @throws RuntimeException If an unknown errorCode is specified
 */
public static ErrorEval valueOf(int errorCode) {
    FormulaError error = FormulaError.forInt(errorCode);
    ErrorEval eval = evals.get(error);
    if (eval != null) {
        return eval;
    } else {
        throw new RuntimeException("Unhandled error type for code " + errorCode);
    }
}
 
源代码3 项目: lams   文件: ErrPtg.java
public static ErrPtg valueOf(int code) {
    switch(FormulaError.forInt(code)) {
        case DIV0: return DIV_ZERO;
        case NA: return N_A;
        case NAME: return NAME_INVALID;
        case NULL: return NULL_INTERSECTION;
        case NUM: return NUM_ERROR;
        case REF: return REF_INVALID;
        case VALUE: return VALUE_INVALID;
        default:
            throw new RuntimeException("Unexpected error code (" + code + ")");
    }
}
 
源代码4 项目: lams   文件: Errortype.java
private int translateErrorCodeToErrorTypeValue(int errorCode) {
	switch (FormulaError.forInt(errorCode)) {
		case NULL:  return 1;
		case DIV0:  return 2;
		case VALUE: return 3;
		case REF:   return 4;
		case NAME:  return 5;
		case NUM:   return 6;
		case NA:    return 7;
		default:
	        throw new IllegalArgumentException("Invalid error code (" + errorCode + ")");
	}
}
 
源代码5 项目: lams   文件: HSSFCell.java
/**
 * set a error value for the cell
 *
 * @param errorCode the error value to set this cell to.  For formulas we'll set the
 *        precalculated value , for errors we'll set
 *        its value. For other types we will change the cell to an error
 *        cell and set its value.
 *        For error code byte, see {@link FormulaError}.
 * @deprecated 3.15 beta 2. Use {@link #setCellErrorValue(FormulaError)} instead.
 */
public void setCellErrorValue(byte errorCode) {
    FormulaError error = FormulaError.forInt(errorCode);
    setCellErrorValue(error);
}