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

Examples of org.apache.poi.hssf.record.formula.AreaPtg


        }
        RefPtg refB = (RefPtg) ptgB;

        if (ptgA instanceof RefPtg) {
            RefPtg refA = (RefPtg) ptgA;
            return new AreaPtg(refA.getRow(), refB.getRow(), refA.getColumn(), refB.getColumn(),
                    refA.isRowRelative(), refB.isRowRelative(), refA.isColRelative(), refB.isColRelative());
        }
        if (ptgA instanceof Ref3DPtg) {
            Ref3DPtg refA = (Ref3DPtg) ptgA;
            return new Area3DPtg(refA.getRow(), refB.getRow(), refA.getColumn(), refB.getColumn(),
View Full Code Here


        String name = iden.getName();
        AreaReference areaRef = parseArea(name);
        if (areaRef != null) {
            // will happen if dots are used instead of colon
            return new AreaPtg(areaRef.formatAsString());
        }
        // This can be either a cell ref or a named range


        int nameType = CellReference.classifyCellReference(name);
        if (nameType == NameType.CELL) {
            return new RefPtg(name);
        }
        if (look == ':') {
            if (nameType == NameType.COLUMN) {
                GetChar();
                String secondIden = parseUnquotedIdentifier();
                if (CellReference.classifyCellReference(secondIden) != NameType.COLUMN) {
                    throw new FormulaParseException("Expected full column after '" + name
                            + ":' but got '" + secondIden + "'");
                }
                return new AreaPtg(name + ":" + secondIden);
            }
        }
        if (nameType != NameType.NAMED_RANGE) {
            new FormulaParseException("Name '" + name
                + "' does not look like a cell reference or named range");
View Full Code Here

                HSSFRow row = xsheet.getRow(rownum);
                HSSFCell cell = (row != null) ? row.getCell(colnum) : null;
                pushRef3DEval(ptg, stack, cell, row, xsheet, workbook);
            }
            else if (ptgs[i] instanceof AreaPtg) {
                AreaPtg ap = (AreaPtg) ptgs[i];
                short row0 = ap.getFirstRow();
                short col0 = ap.getFirstColumn();
                short row1 = ap.getLastRow();
                short col1 = ap.getLastColumn();
                ValueEval[] values = new ValueEval[(row1 - row0 + 1) * (col1 - col0 + 1)];
                for (short x = row0; sheet != null && x < row1 + 1; x++) {
                    HSSFRow row = sheet.getRow(x);
                    for (short y = col0; row != null && y < col1 + 1; y++) {
                        values[(x - row0) * (col1 - col0 + 1) + (y - col0)] =
View Full Code Here

    assertEquals(AreaPtg.class, ops[0].getClass());
    assertEquals(FuncVarPtg.class, ops[1].getClass());

    // Actually stored as C1 to C65536
    // (last row is -1 === 65535)
    AreaPtg ptg = (AreaPtg) ops[0];
    assertEquals(2, ptg.getFirstColumn());
    assertEquals(2, ptg.getLastColumn());
    assertEquals(0, ptg.getFirstRow());
    assertEquals(65535, ptg.getLastRow());
    assertEquals("C:C", ptg.toFormulaString());

    // Will show as C:C, but won't know how many
    // rows it covers as we don't have the sheet
    // to hand when turning the Ptgs into a string
    assertEquals("SUM(C:C)", cellSUM.getCellFormula());
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.record.formula.AreaPtg

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.