Package org.apache.poi.ss.util

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


     *
     * @return null if no pane configured, or the pane information.
     */
    public PaneInformation getPaneInformation() {
        CTPane pane = getPane();
        CellReference cellRef = pane.isSetTopLeftCell() ? new CellReference(pane.getTopLeftCell()) : null;
        return new PaneInformation((short)pane.getXSplit(), (short)pane.getYSplit(),
                (short)(cellRef == null ? 0 : cellRef.getRow()),(cellRef == null ? 0 : cellRef.getCol()),
                (byte)pane.getActivePane().intValue(), pane.getState() == STPaneState.FROZEN);
    }
View Full Code Here


     *
     * @return integer indicating the rownum (0 based) of the top row
     */
    public short getTopRow() {
        String cellRef = getSheetTypeSheetView().getTopLeftCell();
        CellReference cellReference = new CellReference(cellRef);
        return (short) cellReference.getRow();
    }
View Full Code Here

            if(sheetComments != null){
                //TODO shift Note's anchor in the associated /xl/drawing/vmlDrawings#.vml
                CTCommentList lst = sheetComments.getCTComments().getCommentList();
                for (CTComment comment : lst.getCommentArray()) {
                    CellReference ref = new CellReference(comment.getRef());
                    if(ref.getRow() == rownum){
                        ref = new CellReference(rownum + n, ref.getCol());
                        comment.setRef(ref.formatAsString());
                    }
                }
            }
        }
        XSSFRowShifter rowShifter = new XSSFRowShifter(this);
View Full Code Here

     *
     * @param toprow the top row to show in desktop window pane
     * @param leftcol the left column to show in desktop window pane
     */
    public void showInPane(short toprow, short leftcol) {
        CellReference cellReference = new CellReference(toprow, leftcol);
        String cellRef = cellReference.formatAsString();
    getPane().setTopLeftCell(cellRef);
    }
View Full Code Here

     *
     * @param cellRef cell region
     * @param comment the comment to assign
     */
    public void setCellComment(String cellRef, XSSFComment comment) {
        CellReference cellReference = new CellReference(cellRef);

        comment.setRow(cellReference.getRow());
        comment.setColumn(cellReference.getCol());
    }
View Full Code Here

  public static final Pattern DYNAMIC_CELL_PATTREN = Pattern.compile("[A-Z][A-Z]?\\d+");
 
  private static final Logger logger = LoggerFactory.getLogger(ExcelUtil.class);
 
  public static String getCellIndex(int row, int col){
    CellReference cell = new CellReference(row, col);
    return cell.formatAsString().replaceAll("\\$", "");
  }
View Full Code Here

    CellReference cell = new CellReference(row, col);
    return cell.formatAsString().replaceAll("\\$", "");
  }
 
  public static int[] getCellPosition(String cellIndex){   
    CellReference cell = new CellReference(cellIndex);
    return new int[]{cell.getRow(),cell.getCol()};
  }
View Full Code Here

    CellReference cell = new CellReference(cellIndex);
    return new int[]{cell.getRow(),cell.getCol()};
  }
 
  public static String offsetCellIndex(String cellIndex, int rowOffset, int colOffset){
    CellReference cell = new CellReference(cellIndex);
    CellReference newCell = new CellReference(cell.getRow() + rowOffset, cell.getCol() + colOffset);
    return newCell.formatAsString().replaceAll("\\$", "");
  }
View Full Code Here

    public CellReference getCellReference() {
      if (_type != Type.CELL) {
        throw new IllegalStateException("Not applicable to this type");
      }
      return new CellReference(_rep);
    }
View Full Code Here

      switch (part1refType) {
        case COLUMN:
        case ROW:
          return ErrorEval.REF_INVALID;
        case CELL:
          CellReference cr = new CellReference(refStrPart1);
          return new LazyRefEval(cr.getRow(), cr.getCol(), sre);
      }
      throw new IllegalStateException("Unexpected reference classification of '" + refStrPart1 + "'.");
    }
    NameType part2refType = classifyCellReference(refStrPart1, ssVersion);
    switch (part2refType) {
      case BAD_CELL_OR_NAMED_RANGE:
        return ErrorEval.REF_INVALID;
      case NAMED_RANGE:
        throw new RuntimeException("Cannot evaluate '" + refStrPart1
            + "'. Indirect evaluation of defined names not supported yet");
    }

    if (part2refType != part1refType) {
      // LHS and RHS of ':' must be compatible
      return ErrorEval.REF_INVALID;
    }
    int firstRow, firstCol, lastRow, lastCol;
    switch (part1refType) {
      case COLUMN:
        firstRow =0;
        lastRow = ssVersion.getLastRowIndex();
        firstCol = parseColRef(refStrPart1);
        lastCol = parseColRef(refStrPart2);
        break;
      case ROW:
        firstCol = 0;
        lastCol = ssVersion.getLastColumnIndex();
        firstRow = parseRowRef(refStrPart1);
        lastRow = parseRowRef(refStrPart2);
        break;
      case CELL:
        CellReference cr;
        cr = new CellReference(refStrPart1);
        firstRow = cr.getRow();
        firstCol = cr.getCol();
        cr = new CellReference(refStrPart2);
        lastRow = cr.getRow();
        lastCol = cr.getCol();
        break;
      default:
        throw new IllegalStateException("Unexpected reference classification of '" + refStrPart1 + "'.");
    }
    return new LazyAreaEval(firstRow, firstCol, lastRow, lastCol, sre);
View Full Code Here

TOP

Related Classes of org.apache.poi.ss.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.