Package org.apache.poi.ss.util

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


    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


            int firstRow, int firstCol,
            int lastRow, int lastCol) {
        assert sheet != null;
        assert list != null;
        DataValidationHelper helper = sheet.getDataValidationHelper();
        CellRangeAddressList addressList = new CellRangeAddressList(firstRow, lastRow, firstCol, lastCol);
        DataValidationConstraint constraint = helper.createExplicitListConstraint(list);
        DataValidation validation = helper.createValidation(constraint, addressList);
        validation.setEmptyCellAllowed(true);
        sheet.addValidationData(validation);
    }
View Full Code Here

            int firstRow,
            int lastRow,
            int firstCol,
            int lastCol) {
        //データの入力規則を設定するセルを設定する
        CellRangeAddressList addressList = new CellRangeAddressList(firstRow, lastRow, firstCol, lastCol);
        DVConstraint constraint = DVConstraint.createExplicitListConstraint(list);
        HSSFDataValidation validation = new HSSFDataValidation(addressList, constraint);
        validation.setEmptyCellAllowed(true);
        validation.setSuppressDropDownArrow(false);
        sheet.addValidationData(validation);
View Full Code Here

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

        DVConstraint dvc = DVConstraint.createNumericConstraint(DVConstraint.ValidationType.INTEGER,
                                                DVConstraint.OperatorType.BETWEEN, "10", "100");
        CellRangeAddressList numericCellAddressList = new CellRangeAddressList(0, 0, 1, 1);
        HSSFDataValidation dv = new HSSFDataValidation(numericCellAddressList, dvc);
        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

        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

    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.getDataValidationList()) {
          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

    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

    public void testPLVRecord() throws Exception {
        InputStream is = HSSFTestDataSamples.openSampleFileStream(XLS_FILENAME);
        HSSFWorkbook workbook = new HSSFWorkbook(is);

        CellRangeAddressList cellRange = new CellRangeAddressList(0, 0, 1, 1);
        DataValidationConstraint constraint = DVConstraint.createFormulaListConstraint(DV_DEFINITION);
        HSSFDataValidation dataValidation = new HSSFDataValidation(cellRange, constraint);

        // This used to throw an error before
        try {
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 (String region : regions) {
                        String[] parts = region.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

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.