Package org.apache.poi.hssf.util

Examples of org.apache.poi.hssf.util.CellReference


                    refy1=y-4;
                    refy2=y-3;
                }

                c = r.getCell(y);
                CellReference cr= new CellReference(refx1, refy1, false, false);
                String ref=cr.formatAsString();
                ref=cr.formatAsString();
                cr=new CellReference(refx2,refy2, false, false);
                String ref2=cr.formatAsString();


                assertTrue("loop Formula is as expected "+ref+operator+ref2+"!="+c.getCellFormula(),(
                (""+ref+operator+ref2).equals(c.getCellFormula())
                                                         )
View Full Code Here


        }
        String partB = name.substring(dotPos+dotCount);
        if (!isValidCellReference(partB)) {
            return null;
        }
        CellReference topLeft = new CellReference(partA);
        CellReference bottomRight = new CellReference(partB);
        return new AreaReference(topLeft, bottomRight);
    }
View Full Code Here

  /**
   * Takes in a String representation of a cell reference and fills out the
   * numeric fields.
   */
  protected RefPtgBase(String cellref) {
    CellReference c = new CellReference(cellref);
    setRow(c.getRow());
    setColumn(c.getCol());
    setColRelative(!c.isColAbsolute());
    setRowRelative(!c.isRowAbsolute());
  }
View Full Code Here

    return column.getValue(field_2_col);
  }

  protected final String formatReferenceAsString() {
    // Only make cell references as needed. Memory is an issue
    CellReference cr = new CellReference(getRow(), getColumn(), !isRowRelative(), !isColRelative());
    return cr.formatAsString();
  }
View Full Code Here

      default:
        return null;
    }
    int firstRow = LittleEndian.getUShort(data, 1);
    int firstColumn = LittleEndian.getUShort(data, 3);
    return new CellReference(firstRow, firstColumn);
  }
View Full Code Here

      }
      return cce.getValue();
    }
    if (isDebugLogEnabled()) {
      String sheetName = getSheetName(sheetIndex);
      CellReference cr = new CellReference(rowIndex, columnIndex);
      logDebug("Evaluated " + sheetName + "!" + cr.formatAsString() + " to " + cce.getValue().toString());
    }
    return cce.getValue();
  }
View Full Code Here

   */
  private NotImplementedException addExceptionInfo(NotImplementedException inner, int sheetIndex, int rowIndex, int columnIndex) {
   
    try {
      String sheetName = _workbook.getSheetName(sheetIndex);
      CellReference cr = new CellReference(sheetName, rowIndex, columnIndex, false, false);
      String msg =  "Error evaluating cell " + cr.formatAsString();
      return new NotImplementedException(msg, inner);
    } catch (Exception e) {
      // avoid bombing out during exception handling
      e.printStackTrace();
      return inner; // preserve original exception
View Full Code Here

     */
    public void setPrintArea(int sheetIndex, int startColumn, int endColumn,
                              int startRow, int endRow) {

        //using absolute references because they don't get copied and pasted anyway
        CellReference cell = new CellReference(startRow, startColumn, true, true);
        String reference = cell.formatAsString();

        cell = new CellReference(endRow, endColumn, true, true);
        reference = reference+":"+cell.formatAsString();

        setPrintArea(sheetIndex, reference);
    }
View Full Code Here

        }
        return ExcelColorUtils.getColorName(this, border);
    }

    HSSFCell getAdjacentCell(final int dir) {
        final CellReference cellReference = getCellReference();
        short yofs = 0;
        int xofs = 0;
        switch(dir) {
            case TOP: yofs=-1; break;
            case RIGHT: xofs=1; break;
            case BOTTOM: yofs=1; break;
            case LEFT: xofs=-1; break;
            default: throw new IllegalArgumentException("Invalid side: " + dir);
        }
        return ExcelCellUtils.getExcelCellAt(this, cellReference.getRow() + yofs, (short)(cellReference.getCol() + xofs));
    }
View Full Code Here

        nullParamCheck(getCol(), "col");
        optionalIntegerParamCheck(getStartRow(), "startRow", true);
    }

    public void doExecute() {
        final CellReference cellReference = ExcelCellUtils.getCellReference(this, null, getStartRow(), getCol());
        final HSSFSheet excelSheet = getExcelSheet();
        int row = cellReference.getRow();
        while(row <= excelSheet.getLastRowNum()) {
            final HSSFCell excelCellAt = ExcelCellUtils.getExcelCellAt(this, row, cellReference.getCol());
            if (verifyText(ExcelCellUtils.getCellValueAt(excelCellAt))) {
                setWebtestProperty(getProperty(), String.valueOf(row + 1), getPropertyType());
                return;
            }
            row++;
        }
        throw new StepFailedException("No cells were found matching '"+getText()+"' starting from " + cellReference.formatAsString(), this);
    }
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.util.CellReference

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.