Package org.apache.poi.ss.util

Examples of org.apache.poi.ss.util.CellReference.formatAsString()


  }
 
  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("\\$", "");
  }
 
  public static String offsetFormula(String formula, int rowOffset, int colOffset){
    StringBuffer sb = new StringBuffer();
    Matcher matcher = DYNAMIC_CELL_PATTREN.matcher(formula);
View Full Code Here


     *
     * @param col the 0-based column of the cell that contains the comment
     */
    public void setColumn(int col) {
        CellReference ref = new CellReference(getRow(), col);
    _comment.setRef(ref.formatAsString());
        if(_vmlShape != null) _vmlShape.getClientDataArray(0).setColumnArray(0, new BigInteger(String.valueOf(col)));
  }

    /**
     * Set the row of the cell that contains the comment
View Full Code Here

                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);
    }

    public void ungroupColumn(int fromColumn, int toColumn) {
        CTCols cols = worksheet.getColsArray(0);
View Full Code Here

  }

  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();
  }

  public final byte getDefaultOperandClass() {
    return Ptg.CLASS_REF;
  }
View Full Code Here

     * @see org.apache.poi.hssf.usermodel.HSSFSheet#addMergedRegion(org.apache.poi.ss.util.CellRangeAddress)
     * @throws IllegalStateException if modification is not allowed
     */
    void notifyArrayFormulaChanging(){
        CellReference ref = new CellReference(this);
        String msg = "Cell "+ref.formatAsString()+" is part of a multi-cell array formula. " +
                "You cannot change part of an array.";
        notifyArrayFormulaChanging(msg);
    }

}
View Full Code Here

    sb.append(getClass().getName()).append("[");
    sb.append(_evaluator.getSheetName());
    sb.append('!');
    sb.append(crA.formatAsString());
    sb.append(':');
    sb.append(crB.formatAsString());
    sb.append("]");
    return sb.toString();
  }

    /**
 
View Full Code Here

    sb.append(getClass().getName()).append("[");
    sb.append(_evaluator.getSheetNameRange());
    sb.append('!');
    sb.append(crA.formatAsString());
    sb.append(':');
    sb.append(crB.formatAsString());
    sb.append("]");
    return sb.toString();
  }

    /**
 
View Full Code Here

                assertEquals(Cell.CELL_TYPE_FORMULA, mcell.getCellType());
                mcell.setCellType(Cell.CELL_TYPE_NUMERIC);
                fail("expected exception");
            } catch (IllegalStateException e){
                CellReference ref = new CellReference(mcell);
                String msg = "Cell "+ref.formatAsString()+" is part of a multi-cell array formula. You cannot change part of an array.";
                assertEquals(msg, e.getMessage());
            }
            // a failed invocation of Cell.setCellType leaves the cell
            // in the state that it was in prior to the invocation
            assertEquals(Cell.CELL_TYPE_FORMULA, mcell.getCellType());
View Full Code Here

                assertEquals("A1:A3*B1:B3", mcell.getCellFormula());
                mcell.setCellFormula("A1+A2");
                fail("expected exception");
            } catch (IllegalStateException e){
                CellReference ref = new CellReference(mcell);
                String msg = "Cell "+ref.formatAsString()+" is part of a multi-cell array formula. You cannot change part of an array.";
                assertEquals(msg, e.getMessage());
            }
            // a failed invocation of Cell.setCellFormula leaves the cell
            // in the state that it was in prior to the invocation
            assertEquals("A1:A3*B1:B3", mcell.getCellFormula());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.