Package org.zkoss.poi.ss.usermodel

Examples of org.zkoss.poi.ss.usermodel.Row


    boolean shtProtect = sheet.getProtect();
    if (!shtProtect)
      return false;
   
    for (int r = tRow; r <= bRow; r++) {
      Row row = sheet.getRow(r);
      if (row != null) {
        for (int c = lCol; c <= rCol; c++) {
          Cell cell = row.getCell(c);
          if (shtProtect && cell != null && cell.getCellStyle().getLocked()) {
            return true;
          } else if (shtProtect && cell == null) {
            return true;
          }
View Full Code Here


   
    return orderedRowInfos;
  }
 
  private static boolean isHiddenRow(int rowIdx, Worksheet worksheet) {
    final Row r = worksheet.getRow(rowIdx);
    return r != null && r.getZeroHeight();
  }
View Full Code Here

    }
    return null;
  }
 
  public static Cell getCell(Worksheet sheet, int rowIndex, int colIndex) {
    final Row row = sheet.getRow(rowIndex);
    if (row != null) {
      return row.getCell(colIndex);
    }
    return null;
  }
View Full Code Here

    }
    return null;
  }
 
  public static Cell getOrCreateCell(Worksheet sheet, int rowIndex, int colIndex) {
    Row row = sheet.getRow(rowIndex);
    if (row == null) {
      row = sheet.createRow(rowIndex);
    }
    Cell cell = row.getCell(colIndex);
    if (cell == null) {
      cell = row.createCell(colIndex);
    }
    return cell;
  }
View Full Code Here

    //TODO when BookHelper refactor to singleton, DateInputMask can be a private variable
    return new DateInputMask().parseDateInput(txt);
  }
 
  public static Row getOrCreateRow(Worksheet sheet, int rowIndex) {
    Row row = sheet.getRow(rowIndex);
    if (row == null) {
      row = sheet.createRow(rowIndex);
    }
    return row;
  }
View Full Code Here

    if (sortByRows) {
      int begCol = ((Book)sheet.getWorkbook()).getSpreadsheetVersion().getLastColumnIndex();
      int endCol = 0;
      //locate begCol/endCol of the sheet
      for (int rowNum = begRow; rowNum <= endRow; ++rowNum) {
        final Row row = sheet.getRow(rowNum);
        if (row != null) {
          begCol = Math.min(begCol, row.getFirstCellNum());
          endCol = Math.max(begCol, row.getLastCellNum() - 1);
        }
      }
      begCol = Math.max(lCol, begCol);
      endCol = Math.min(rCol, endCol);
      for (int colnum = begCol; colnum <= endCol; ++colnum) {
        final Object[] values = new Object[keyCount];
        for(int j = 0; j < keyCount; ++j) {
          final Row row = sheet.getRow(keyIndexes[j]);
          final Cell cell = row != null ? row.getCell(colnum, Row.RETURN_BLANK_AS_NULL) : null;
          final Object val = getCellObject(cell, dataOptions[j]);
          values[j] = val;
        }
        final SortKey sortKey = new SortKey(colnum, values);
        sortKeys.add(sortKey);
      }
      if (!sortKeys.isEmpty()) {
        final Comparator<SortKey> keyComparator = new KeyComparator(descs, matchCase, sortMethod, type);
        Collections.sort(sortKeys, keyComparator);
        return BookHelper.assignColumns(sheet, sortKeys, begRow, lCol, endRow, rCol);
      } else {
        return null;
      }
    } else { //sortByColumn, default case
      for (int rownum = begRow; rownum <= endRow; ++rownum) {
        final Row row = sheet.getRow(rownum);
        if (row == null) {
          continue; //nothing to sort
        }
        final Object[] values = new Object[keyCount];
        for(int j = 0; j < keyCount; ++j) {
          final Cell cell = row.getCell(keyIndexes[j], Row.RETURN_BLANK_AS_NULL);
          final Object val = getCellObject(cell, dataOptions[j]);
          values[j] = val;
        }
        final SortKey sortKey = new SortKey(rownum, values);
        sortKeys.add(sortKey);
View Full Code Here

    final ChangeInfo changeInfo = new ChangeInfo(toEval, affected, mergeChanges);
    int j = 0;
    for(final Iterator<SortKey> it = sortKeys.iterator(); it.hasNext();++j) {
      final SortKey sortKey = it.next();
      final int oldRowNum = sortKey.getIndex();
      final Row row = sheet.getRow(oldRowNum);
      final int newRowNum = tRow + j;
      it.remove();
      if (oldRowNum == newRowNum) { //no move needed, skip it
        continue;
      }
      //remove cells from the old row of the Range
      final List<Cell> cells = new ArrayList<Cell>(cellCount);
      final int begCol = Math.max(lCol, row.getFirstCellNum());
      final int endCol = Math.min(rCol, row.getLastCellNum() - 1);
      for(int k = begCol; k <= endCol; ++k) {
        final Cell cell = row.getCell(k);
        if (cell != null) {
          cells.add(cell);
          final Set<Ref>[] refs = BookHelper.removeCell(cell, false);
          assignRefs(toEval, affected, refs);
        }
View Full Code Here

    final Book book = (Book) sheet.getWorkbook();
    final int maxcol = book.getSpreadsheetVersion().getLastColumnIndex();
    final RefSheet refSheet = BookHelper.getRefSheet(book, sheet);
    final Set<Ref> all = new HashSet<Ref>();
    for (int row = tRow; row <= bRow; ++row) {
      Row rowobj = sheet.getRow(row);
      final int orgTwips = rowobj == null ? sheet.getDefaultRowHeight() : rowobj.getHeight();
      if ((twips < 0 && orgTwips < 0) || twips == orgTwips) {
        continue;
      }
      BookHelper.setRowHeight(sheet, row, twips, customHeight);
      all.add(new AreaRefImpl(row, 0, row, maxcol, refSheet));
View Full Code Here

    }
    return all;
  }
 
  public static void setRowHeight(Worksheet sheet, int row, short twips, boolean customHeight) {
    final Row rowx = BookHelper.getOrCreateRow(sheet, row);
    rowx.setHeight(twips);
    rowx.setCustomHeight(twips < 0 ? false : customHeight);
  }
View Full Code Here

    rowx.setHeight(twips);
    rowx.setCustomHeight(twips < 0 ? false : customHeight);
  }
 
  public static short getRowHeight(Worksheet sheet, int row) {
    final Row rowx = sheet.getRow(row);
    return rowx != null ? getRowHeight(rowx) : sheet.getDefaultRowHeight();
  }
View Full Code Here

TOP

Related Classes of org.zkoss.poi.ss.usermodel.Row

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.