Package org.apache.poi.ss.util

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


      List<XSSFDataValidation> xssfValidations = new ArrayList<XSSFDataValidation>();
      CTDataValidations dataValidations = this.worksheet.getDataValidations();
      if( dataValidations!=null && dataValidations.getCount() > 0 ) {
        CTDataValidation[] dataValidationList = dataValidations.getDataValidationArray();
        for (CTDataValidation ctDataValidation : dataValidationList) {
          CellRangeAddressList addressList = new CellRangeAddressList();
         
          @SuppressWarnings("unchecked")
          List<String> sqref = ctDataValidation.getSqref();
          for (String stRef : sqref) {
            String[] regions = stRef.split(" ");
            for (int i = 0; i < regions.length; i++) {
            String[] parts = regions[i].split(":");
            CellReference begin = new CellReference(parts[0]);
            CellReference end = parts.length > 1 ? new CellReference(parts[1]) : begin;
            CellRangeAddress cellRangeAddress = new CellRangeAddress(begin.getRow(), end.getRow(), begin.getCol(), end.getCol());
            addressList.addCellRangeAddress(cellRangeAddress);
          }
        }
        XSSFDataValidation xssfDataValidation = new XSSFDataValidation(addressList, ctDataValidation);
        xssfValidations.add(xssfDataValidation);
      }
View Full Code Here


        HSSFSheet sheet = workbook.createSheet("Sheet1");
        sheet.protectSheet("secret");

        DataValidationHelper dataValidationHelper = sheet.getDataValidationHelper();
        DataValidationConstraint dvc = dataValidationHelper.createIntegerConstraint(DataValidationConstraint.OperatorType.BETWEEN, "10", "100");
        CellRangeAddressList numericCellAddressList = new CellRangeAddressList(0, 0, 1, 1);
        DataValidation dv = dataValidationHelper.createValidation(dvc,numericCellAddressList);
        try {
            sheet.addValidationData(dv);
        } catch (IllegalStateException e) {
            String expMsg = "Unexpected (org.apache.poi.hssf.record.PasswordRecord) while looking for DV Table insert pos";
View Full Code Here

  private CellRangeAddressList field_4_cell_ranges;

  /** Creates new CFHeaderRecord */
  public CFHeaderRecord()
  {
    field_4_cell_ranges = new CellRangeAddressList();
  }
View Full Code Here

  public CFHeaderRecord(RecordInputStream in)
  {
    field_1_numcf = in.readShort();
    field_2_need_recalculation = in.readShort();
    field_3_enclosing_cell_range = new CellRangeAddress(in);
    field_4_cell_ranges = new CellRangeAddressList(in);
  }
View Full Code Here

  {
    if(cellRanges == null)
    {
      throw new IllegalArgumentException("cellRanges must not be null");
    }
    CellRangeAddressList cral = new CellRangeAddressList();
    CellRangeAddress enclosingRange = null;
    for (int i = 0; i < cellRanges.length; i++)
    {
      CellRangeAddress cr = cellRanges[i];
      enclosingRange = CellRangeUtil.createEnclosingCellRange(cr, enclosingRange);
      cral.addCellRangeAddress(cr);
    }
    field_3_enclosing_cell_range = enclosingRange;
    field_4_cell_ranges = cral;
  }
View Full Code Here

    public List<XSSFDataValidation> getDataValidations() {
      List<XSSFDataValidation> xssfValidations = new ArrayList<XSSFDataValidation>();
      CTDataValidations dataValidations = this.worksheet.getDataValidations();
      if( dataValidations!=null && dataValidations.getCount() > 0 ) {
        for (CTDataValidation ctDataValidation : dataValidations.getDataValidationArray()) {
          CellRangeAddressList addressList = new CellRangeAddressList();
         
          @SuppressWarnings("unchecked")
          List<String> sqref = ctDataValidation.getSqref();
          for (String stRef : sqref) {
            String[] regions = stRef.split(" ");
            for (int i = 0; i < regions.length; i++) {
            String[] parts = regions[i].split(":");
            CellReference begin = new CellReference(parts[0]);
            CellReference end = parts.length > 1 ? new CellReference(parts[1]) : begin;
            CellRangeAddress cellRangeAddress = new CellRangeAddress(begin.getRow(), end.getRow(), begin.getCol(), end.getCol());
            addressList.addCellRangeAddress(cellRangeAddress);
          }
        }
        XSSFDataValidation xssfDataValidation = new XSSFDataValidation(addressList, ctDataValidation);
        xssfValidations.add(xssfDataValidation);
      }
View Full Code Here

        HSSFSheet sheet = workbook.createSheet("Sheet1");
        sheet.protectSheet("secret");

        DataValidationHelper dataValidationHelper = sheet.getDataValidationHelper();
        DataValidationConstraint dvc = dataValidationHelper.createIntegerConstraint(DataValidationConstraint.OperatorType.BETWEEN, "10", "100");
        CellRangeAddressList numericCellAddressList = new CellRangeAddressList(0, 0, 1, 1);
        DataValidation dv = dataValidationHelper.createValidation(dvc,numericCellAddressList);
        try {
            sheet.addValidationData(dv);
        } catch (IllegalStateException e) {
            String expMsg = "Unexpected (org.apache.poi.hssf.record.PasswordRecord) while looking for DV Table insert pos";
View Full Code Here

      int rowNum = _currentRowIndex++;

      DataValidationHelper dataValidationHelper = _sheet.getDataValidationHelper();
      DataValidationConstraint dc = createConstraint(dataValidationHelper,operatorType, firstFormula, secondFormula, explicitListValues);

      DataValidation dv = dataValidationHelper.createValidation(dc,new CellRangeAddressList(rowNum, rowNum, 0, 0));

      dv.setEmptyCellAllowed(allowEmpty);
      dv.setErrorStyle(errorStyle);
      dv.createErrorBox("Invalid Input", "Something is wrong - check condition!");
      dv.createPromptBox("Validated Cell", "Allowable values have been restricted");
View Full Code Here

    HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("dvEmpty.xls")
    int dvRow = 0;
    Sheet sheet = wb.getSheetAt(0);
    DataValidationHelper dataValidationHelper = sheet.getDataValidationHelper();
    DataValidationConstraint dc = dataValidationHelper.createIntegerConstraint(OP.EQUAL, "42", null);
    DataValidation dv = dataValidationHelper.createValidation(dc,new CellRangeAddressList(dvRow, dvRow, 0, 0));
   
    dv.setEmptyCellAllowed(false);
    dv.setErrorStyle(ES.STOP);
    dv.setShowPromptBox(true);
    dv.createErrorBox("Xxx", "Yyy");
View Full Code Here

    // read sec formula data condition
    _formula2 = Formula.read(field_size_sec_formula, in);

    // read cell range address list with all affected ranges
    _regions = new CellRangeAddressList(in);
  }
View Full Code Here

TOP

Related Classes of org.apache.poi.ss.util.CellRangeAddressList

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.