Examples of CellRangeAddress


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

        stack.removeContext("lineNum");
             
        //if no data, just remove the dummy data   
        //[2013-2-26]it seems that we also need to remove all merged regions for shift   
        for(int i=sheet.getNumMergedRegions()-1; i>=0; i--){
          CellRangeAddress cra = sheet.getMergedRegion(i);       
          if(cra.getFirstRow() >= blockDefinition.getStartRow() &&
              cra.getFirstColumn() >= blockDefinition.getStartCol() &&
              cra.getLastRow() <= blockDefinition.getEndRow() &&
              cra.getLastColumn() <= blockDefinition.getEndCol()){
            sheet.removeMergedRegion(i);
            logger.debug("Removed Merged Region:[{}-{}]",
                ExcelUtil.getCellIndex(cra.getFirstRow(), cra.getFirstColumn()),
                ExcelUtil.getCellIndex(cra.getLastRow(), cra.getLastColumn()));
          }
        }
        //[2013-2-22]if with data, still need to remove dummy one, otherwise xlsx will have error if there are formulas in block.
        for(int i = blockDefinition.getEndRow(); i>= blockDefinition.getStartRow(); i--)
          sheet.removeRow(sheet.getRow(i));     
View Full Code Here

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
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.