Package org.zkoss.poi.ss.util

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


      for(DataValidation dataValidation : dataValidations) {
        CellRangeAddressList addrList = dataValidation.getRegions();
        boolean srcInRange = false;
        boolean dstInRange = false;
        for(int j = addrList.countRanges(); --j >= 0;) {
          final CellRangeAddress addr = addrList.getCellRangeAddress(j);
          if (!srcInRange) {
            srcInRange = addr.isInRange(srcRow, srcCol);
          }
          if (!dstInRange) {
            dstInRange = addr.isInRange(dstRow, dstCol);
          }
          if (srcInRange && dstInRange) { //no need to copy
            break;
          }
        }
        if (!srcInRange) { //this validation is not associated to source cell
          continue;
        }
        if (!dstInRange) { //so we shall copy this data validation to dst cell
          dataValidation.getRegions().addCellRangeAddress(dstRow, dstCol, dstRow, dstCol);
        }
      }
    } else {
      final DataValidationHelper helper = dstSheet.getDataValidationHelper();
      for(DataValidation dataValidation : dataValidations) {
        CellRangeAddressList addrList = dataValidation.getRegions();
        boolean srcInRange = false;
        for(int j = addrList.countRanges(); --j >= 0;) {
          final CellRangeAddress addr = addrList.getCellRangeAddress(j);
          if (!srcInRange) {
            srcInRange = addr.isInRange(srcRow, srcCol);
          }
          if (srcInRange) {
            break;
          }
        }
View Full Code Here


    return _showContextMenu;
  }
 
  private Map convertAutoFilterToJSON(AutoFilter af) {
    if (af != null) {
      final CellRangeAddress addr = af.getRangeAddress();
      if (addr == null) {
        return null;
      }
      final Map addrmap = new HashMap();
      final int left = addr.getFirstColumn();
      final int right = addr.getLastColumn();
      final int top = addr.getFirstRow();
      final Worksheet sheet = this.getSelectedSheet();
      addrmap.put("left", left);
      addrmap.put("top", top);
      addrmap.put("right", right);
      addrmap.put("bottom", addr.getLastRow());
     
      int offcol = -1;
      final List<FilterColumn> fcs = af.getFilterColumns();
      final List<Map> fcsary = fcs != null ? new ArrayList<Map>(fcs.size()) : null;
      if (fcsary != null) {
View Full Code Here

  private Map convertDataValidationToJSON(DataValidation dv) {
    final CellRangeAddressList addrList = dv.getRegions();
    final int addrCount = addrList.countRanges();
    final List<Map> addrmapary = new ArrayList<Map>(addrCount);
    for (int j = 0; j < addrCount; ++j) {
      final CellRangeAddress addr = addrList.getCellRangeAddress(j);
      final int left = addr.getFirstColumn();
      final int right = addr.getLastColumn();
      final int top = addr.getFirstRow();
      final int bottom = addr.getLastRow();
      final Worksheet sheet = this.getSelectedSheet();
      final Map<String, Integer> addrmap = new HashMap<String, Integer>();
      addrmap.put("left", left);
      addrmap.put("top", top);
      addrmap.put("right", right);
View Full Code Here

    int fzc = getColumnfreeze();
    if (mmhelper == null) {
      final int sz = sheet.getNumMergedRegions();
      final List<int[]> mergeRanges = new ArrayList<int[]>(sz);
      for(int j = sz - 1; j >= 0; --j) {
        final CellRangeAddress addr = sheet.getMergedRegion(j);
        mergeRanges.add(new int[] {addr.getFirstColumn(), addr.getFirstRow(), addr.getLastColumn(), addr.getLastRow()});
      }
      helpers.putHelper(sheetId, mmhelper = new MergeMatrixHelper(mergeRanges, fzr, fzc));
    } else {
      mmhelper.update(fzr, fzc);
    }
View Full Code Here

  @Override
  public CellRangeAddress getRepeatingRowsAndColumns(int sheetNumber) {
    final XSSFName name = getBuiltInName(XSSFName.BUILTIN_PRINT_TITLE, sheetNumber);
    if (name == null) {
      return new CellRangeAddress(-1, -1, -1, -1);
    } else {
      final String formula = name.getRefersToFormula();
      final Ptg[] ptgs = FormulaParser.parse(formula, XSSFEvaluationWorkbook.create(this), FormulaType.NAMEDRANGE, name.getSheetIndex());
      return BookHelper.getRepeatRowsAndColumns(ptgs);
    }
View Full Code Here

    }
   
    if (minr < 0 || maxc < 0) { //all blanks!
      return null;
    }
    return new CellRangeAddress(minr, maxr, minc, maxc);
  }
View Full Code Here

  public Range getCurrentRegion() {
    synchronized (_sheet) {
      final Ref ref = getRefs().iterator().next();
      final int row = ref.getTopRow();
      final int col = ref.getLeftCol();
      CellRangeAddress cra = getCurrentRegion(_sheet, row, col);
      return cra == null ?
          new RangeImpl(row, col, _sheet, _sheet) :
          new RangeImpl(cra.getFirstRow(), cra.getFirstColumn(), cra.getLastRow(), cra.getLastColumn(), _sheet, _sheet);
    }
  }
View Full Code Here

          new RangeImpl(cra.getFirstRow(), cra.getFirstColumn(), cra.getLastRow(), cra.getLastColumn(), _sheet, _sheet);
    }
  }
 
  private int[] getCellMinMax(Worksheet sheet, int row, int col) {
    final CellRangeAddress rng = BookHelper.getMergeRegion(sheet, row, col);
    final int t = rng.getFirstRow();
    final int l = rng.getFirstColumn();
    final int b = rng.getLastRow();
    final int r = rng.getLastColumn();
    final Cell cell = BookHelper.getCell(sheet, t, l);
    return (!BookHelper.isBlankCell(cell)) ?
      new int[] {l, t, r, b} : null;
  }
View Full Code Here

      if (foundMax) {
        maxc = c;
      }
    }

    return new CellRangeAddress(minr, maxr, minc, maxc);
  }
View Full Code Here

    } while(!stopu || !stopd);
   
    if (minr == Integer.MAX_VALUE && maxr < 0) { //all blanks in 9 cells!
      return null;
    }
    return new CellRangeAddress(minr, maxr, minc, maxc);
  }
View Full Code Here

TOP

Related Classes of org.zkoss.poi.ss.util.CellRangeAddress

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.