Examples of HSSFDataValidation


Examples of org.apache.poi.hssf.usermodel.HSSFDataValidation

            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

Examples of org.apache.poi.hssf.usermodel.HSSFDataValidation

        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 {
            workbook.getSheet(SHEET_NAME).addValidationData(dataValidation);
        } catch (IllegalStateException ex) {
View Full Code Here

Examples of org.zkoss.poi.hssf.usermodel.HSSFDataValidation

      if (r instanceof DVRecord) {
        final DVRecord dvRecord = (DVRecord) r;
        final CellRangeAddressList regions = dvRecord.getCellRangeAddress();
        final DataValidationConstraint constraint = createContraint(dvRecord);
        if (constraint != null) {
          HSSFDataValidation dataValidation = new HSSFDataValidation(regions, constraint);
          final boolean allowed = dvRecord.getEmptyCellAllowed();
          final int errStyle = dvRecord.getErrorStyle();
          final boolean showErr = dvRecord.getShowErrorOnInvalidValue();
          final boolean showPrompt = dvRecord.getShowPromptOnCellSelected();
          final boolean suppress = dvRecord.getSuppressDropdownArrow();
         
          final String promptTitle = dvRecord.getPromptTitle();
          final String promptText = dvRecord.getPromptText();
          final String errorTitle = dvRecord.getErrorTitle();
          final String errorText = dvRecord.getErrorText();
          if (showPrompt) {
            dataValidation.createPromptBox(promptTitle, promptText);
          }
          if (showErr) {
            dataValidation.createErrorBox(errorTitle, errorText);
          }
          dataValidation.setEmptyCellAllowed(allowed);
          dataValidation.setErrorStyle(errStyle);
          dataValidation.setShowErrorBox(showErr);
          dataValidation.setShowPromptBox(showPrompt);
          dataValidation.setSuppressDropDownArrow(suppress);
         
          _dataValidations.add(dataValidation);
        }
      }
    }
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.