Package org.apache.poi.hssf.record.formula.eval

Examples of org.apache.poi.hssf.record.formula.eval.StringEval


                BoolEval be = (BoolEval) eval;
                retval = new CellValue(HSSFCell.CELL_TYPE_BOOLEAN);
                retval.setBooleanValue(be.getBooleanValue());
            }
            else if (eval instanceof StringEval) {
                StringEval ne = (StringEval) eval;
                retval = new CellValue(HSSFCell.CELL_TYPE_STRING);
                retval.setStringValue(ne.getStringValue());
            }
            else if (eval instanceof BlankEval) {
                retval = new CellValue(HSSFCell.CELL_TYPE_BLANK);
            }
            else {
View Full Code Here


            switch (cell.getCellType()) {
            case HSSFCell.CELL_TYPE_NUMERIC:
                retval = new NumberEval(cell.getNumericCellValue());
                break;
            case HSSFCell.CELL_TYPE_STRING:
                retval = new StringEval(cell.getRichStringCellValue().getString());
                break;
            case HSSFCell.CELL_TYPE_FORMULA:
                retval = internalEvaluate(cell, row, sheet, workbook);
                break;
            case HSSFCell.CELL_TYPE_BOOLEAN:
View Full Code Here

            switch (cell.getCellType()) {
            case HSSFCell.CELL_TYPE_NUMERIC:
                stack.push(new Ref2DEval(ptg, new NumberEval(cell.getNumericCellValue()), false));
                break;
            case HSSFCell.CELL_TYPE_STRING:
                stack.push(new Ref2DEval(ptg, new StringEval(cell.getRichStringCellValue().getString()), false));
                break;
            case HSSFCell.CELL_TYPE_FORMULA:
                stack.push(new Ref2DEval(ptg, internalEvaluate(cell, row, sheet, workbook), true));
                break;
            case HSSFCell.CELL_TYPE_BOOLEAN:
View Full Code Here

            switch (cell.getCellType()) {
            case HSSFCell.CELL_TYPE_NUMERIC:
                stack.push(new Ref3DEval(ptg, new NumberEval(cell.getNumericCellValue()), false));
                break;
            case HSSFCell.CELL_TYPE_STRING:
                stack.push(new Ref3DEval(ptg, new StringEval(cell.getRichStringCellValue().getString()), false));
                break;
            case HSSFCell.CELL_TYPE_FORMULA:
                stack.push(new Ref3DEval(ptg, internalEvaluate(cell, row, sheet, workbook), true));
                break;
            case HSSFCell.CELL_TYPE_BOOLEAN:
View Full Code Here

            }
        case 1:
            ValueEval veval = singleOperandEvaluate(operands[0], srcCellRow, srcCellCol);
            String str = null;
            if (veval instanceof StringEval) {
                StringEval stringEval = (StringEval) veval;
                str = stringEval.getStringValue();
            }
            else if (veval instanceof BoolEval) {
                BoolEval beval = (BoolEval) veval;
                str = beval.getBooleanValue() ? "TRUE" : "FALSE";
            }
            else if (veval instanceof NumberEval) {
                NumberEval neval = (NumberEval) veval;
                str = neval.getStringValue();
            }
            if (null != str) {
                int strlen = str.length();
                str = str.substring(Math.max(0, strlen-index));
                retval = new StringEval(str);
            }
        }
        return retval;
    }
View Full Code Here

            NumberEval neval = (NumberEval) eval;
            double d = neval.getNumberValue();
            numval = (int) d;
        }
        else if (eval instanceof StringEval) {
            StringEval seval = (StringEval) eval;
            String s = seval.getStringValue();
            try {
                double d = Double.parseDouble(s);
                numval = (int) d;
            }
            catch (Exception e) {
View Full Code Here

            }
        case 1:
            ValueEval veval = singleOperandEvaluate(operands[0], srcCellRow, srcCellCol);
            String str = null;
            if (veval instanceof StringEval) {
                StringEval stringEval = (StringEval) veval;
                str = stringEval.getStringValue();
            }
            else if (veval instanceof BoolEval) {
                BoolEval beval = (BoolEval) veval;
                str = beval.getBooleanValue() ? "TRUE" : "FALSE";
            }
            else if (veval instanceof NumberEval) {
                NumberEval neval = (NumberEval) veval;
                str = neval.getStringValue();
            }
            if (null != str) {
                str = str.substring(0, Math.min(str.length(), index));
                retval = new StringEval(str);
            }
        }
        return retval;
    }
View Full Code Here

            NumberEval neval = (NumberEval) eval;
            double d = neval.getNumberValue();
            numval = (int) d;
        }
        else if (eval instanceof StringEval) {
            StringEval seval = (StringEval) eval;
            String s = seval.getStringValue();
            try {
                double d = Double.parseDouble(s);
                numval = (int) d;
            }
            catch (Exception e) {
View Full Code Here

        else if (ve instanceof NumberEval) {
            NumberEval ne = (NumberEval) ve;
            retval = ne.getNumberValue() != 0 ? BoolEval.TRUE : BoolEval.FALSE;
        }
        else if (ve instanceof StringEval) {
            StringEval se = (StringEval) ve;
            String str = se.getStringValue();
            retval = str.equalsIgnoreCase("true")
                    ? BoolEval.TRUE
                    : str.equalsIgnoreCase("false")
                            ? BoolEval.FALSE
                            : (ValueEval) ErrorEval.VALUE_INVALID;
View Full Code Here

            }
        }
       
        if (retval == null) {
            s = (s == null) ? EMPTY_STRING : s;
            retval = new StringEval(s.toLowerCase());
        }
       
        return retval;
    }
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.record.formula.eval.StringEval

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.