Package org.zkoss.poi.ss.util

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


    final int maxcol = ver.getLastColumnIndex();
    final int maxrow = ver.getLastRowIndex();

    AreaReference ref = null;
    try {
      final CellReference c1 = new CellReference(c1str);
      if (c1.getCol() <= maxcol && c1.getRow() <= maxrow) {
        final CellReference c2 = rb != null ? new CellReference(rb) : c1;
        if (rb != null) {
          if (c2.getCol() <= maxcol && c2.getRow() <= maxrow) {
            ref = new AreaReference(c1, c2);
          }
        } else {
          ref = new AreaReference(c1, c2);
        }
View Full Code Here


   * @param sheet the {@link Worksheet} the Range will refer to.
   * @param ref the AreaReference the Range will refer to.
   * @return the associated {@link Range} of the specified {@link Worksheet} and area reference string (e.g. "A1:D4").
   */
  public static Range range(Worksheet sheet, AreaReference ref) {
    final CellReference c1 = ref.getFirstCell();
    final CellReference c2 = ref.getLastCell();
    final String sheetnm1 = c1.getSheetName();
    final String sheetnm2 = c2.getSheetName();
    final Book book = sheet.getBook();
    final Worksheet sheet1 = sheetnm1 != null ? book.getWorksheet(sheetnm1) : sheet;
    final Worksheet sheet2 = sheetnm2 != null ? book.getWorksheet(sheetnm2) : sheet;
    final int tRow = c1.getRow();
    final int lCol = c1.getCol();
    final int bRow = c2.getRow();
    final int rCol = c2.getCol();
    return newRange(sheet1, sheet2, tRow, lCol, bRow, rCol);
  }
View Full Code Here

              final CommentsTable sheetComments = getCommentsTable(false);
              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());
                      }
                  }
              }
            }
        }
View Full Code Here

              final CommentsTable sheetComments = getCommentsTable(false);
              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());
                      final int colnum = ref.getCol();
                      if(ref.getRow() == rownum && lCol <= colnum && colnum <= rCol){
                          ref = new CellReference(rownum + n, colnum);
                          comment.setRef(ref.formatAsString());
                      }
                  }
              }
            }
        }
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 (final Iterator<CTComment> it = lst.getCommentList().iterator(); it.hasNext();) {
                  CTComment comment = it.next();
                    CellReference ref = new CellReference(comment.getRef());
                    final int colnum = ref.getCol();
                    if(startCol <= colnum && colnum <= endCol){
                      int newColNum = colnum + n;
                      if (newColNum < 0 || newColNum > maxcol) { //out of bound, shall remove it
                        it.remove();
                      } else {
                          ref = new CellReference(ref.getRow(), newColNum);
                          comment.setRef(ref.formatAsString());
                      }
                    }
                }
            }
        }
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 (final Iterator<CTComment> it = lst.getCommentList().iterator(); it.hasNext();) {
                  CTComment comment = it.next();
                    CellReference ref = new CellReference(comment.getRef());
                    final int colnum = ref.getCol();
                    final int rownum = ref.getRow();
                    if(startCol <= colnum && colnum <= endCol && tRow <= rownum && rownum <= bRow){
                      int newColNum = colnum + n;
                      if (newColNum < 0 || newColNum > maxcol) { //out of bound, shall remove it
                        it.remove();
                      } else {
                          ref = new CellReference(ref.getRow(), newColNum);
                          comment.setRef(ref.formatAsString());
                      }
                    }
                }
            }
        }
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 (final Iterator<CTComment> it = lst.getCommentList().iterator(); it.hasNext();) {
                  CTComment comment = it.next();
                    CellReference ref = new CellReference(comment.getRef());
                    final int colnum = ref.getCol();
                    final int rownum = ref.getRow();
                    if(lCol <= colnum && colnum <= rCol && tRow <= rownum && rownum <= bRow){
                      int newColNum = colnum + nCol;
                      int newRowNum = rownum + nRow;
                      if (newColNum < 0 || newColNum > maxcol
                        || newRowNum < 0 || newRowNum > maxrow) { //out of bound, shall remove it
                        it.remove();
                      } else {
                          ref = new CellReference(newRowNum, newColNum);
                          comment.setRef(ref.formatAsString());
                      }
                    }
                }
            }
        }
View Full Code Here

 
  //20110511, peterkuo@potix.com
  //modified from formatAsString() in CellRangeAddress.java
  private static String convertToAbsoluteString(CellRangeAddress cra){
        StringBuffer sb = new StringBuffer();
        CellReference cellRefFrom = new CellReference(cra.getFirstRow(), cra.getFirstColumn(),true,true);
        CellReference cellRefTo = new CellReference(cra.getLastRow(), cra.getLastColumn(),true,true);
        sb.append(cellRefFrom.formatAsString());
        //for a single-cell reference return A1 instead of A1:A1
        if(!cellRefFrom.equals(cellRefTo)){
            sb.append(':');
            sb.append(cellRefTo.formatAsString());
        }
        return sb.toString();
  }
View Full Code Here

    final int srcRow = ec.getRowIndex();
    final int srcCol = ec.getColumnIndex();
    final RefBook srcRefBook = BookHelper.getOrCreateRefBook(_book);
    final RefSheet srcRefSheet = srcRefBook.getOrCreateRefSheet(srcSheetName);
    if (ctx != null) {
      final String srcRefKey = srcRefBook.getBookName()+"]"+srcSheetName+"!"+new CellReference(srcRow, srcCol).formatAsString();
      final Object[] refs = (Object[]) ctx.getAttribute(srcRefKey);
      if (refs != null) {
        srcRef = (CellRefImpl) refs[0];
        isOld = ((Boolean)refs[1]).booleanValue();
      } else {
View Full Code Here

TOP

Related Classes of org.zkoss.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.