FileDocCategorySizeDatePackage
TextFunction.javaAPI DocApache Poi 3.0.13686Sun Mar 11 12:59:30 GMT 2007org.apache.poi.hssf.record.formula.functions

TextFunction

public abstract class TextFunction extends Object implements Function
author
Amol S. Deshmukh < amolweb at ya hoo dot com >

Fields Summary
protected static final String
EMPTY_STRING
Constructors Summary
Methods Summary
protected org.apache.poi.hssf.record.formula.eval.ValueEvalattemptXlateToText(org.apache.poi.hssf.record.formula.eval.ValueEval ve)
converts from Different ValueEval types to StringEval. Note: AreaEvals are not handled, if arg is an AreaEval, the returned value is ErrorEval.VALUE_INVALID

param
ve
return

        ValueEval retval;
        if (ve instanceof StringValueEval) {
            retval = ve;
        }
        else if (ve instanceof RefEval) {
            RefEval re = (RefEval) ve;
            ValueEval ive = re.getInnerValueEval();
            if (ive instanceof StringValueEval) {
                retval = ive;
            }
            else if (ive instanceof BlankEval) {
                retval = ive;
            }
            else {
                retval = ErrorEval.VALUE_INVALID;
            }
        }
        else if (ve instanceof BlankEval) {
            retval = ve;
        }
        else {
            retval = ErrorEval.VALUE_INVALID;
        }
        return retval;
    
protected org.apache.poi.hssf.record.formula.eval.ValueEvalsingleOperandEvaluate(org.apache.poi.hssf.record.formula.eval.Eval eval, int srcRow, short srcCol)

    
            
        ValueEval retval;
        if (eval instanceof AreaEval) {
            AreaEval ae = (AreaEval) eval;
            if (ae.contains(srcRow, srcCol)) { // circular ref!
                retval = ErrorEval.CIRCULAR_REF_ERROR;
            }
            else if (ae.isRow()) {
                if (ae.containsColumn(srcCol)) {
                    ValueEval ve = ae.getValueAt(ae.getFirstRow(), srcCol);
                    retval = attemptXlateToText(ve);
                }
                else {
                    retval = ErrorEval.VALUE_INVALID;
                }
            }
            else if (ae.isColumn()) {
                if (ae.containsRow(srcRow)) {
                    ValueEval ve = ae.getValueAt(srcRow, ae.getFirstColumn());
                    retval = attemptXlateToText(ve);
                }
                else {
                    retval = ErrorEval.VALUE_INVALID;
                }
            }
            else {
                retval = ErrorEval.VALUE_INVALID;
            }
        }
        else {
            retval = attemptXlateToText((ValueEval) eval);
        }
        return retval;