Ejemplo n.º 1
0
            private void AddValidationInternal(int operatorType, String firstFormula,
                                               String secondFormula, HSSFDataValidation.ERRORSTYLE errorStyle, String ruleDescr, String promptDescr,
                                               bool allowEmpty, bool inputBox, bool errorBox, bool suppressDropDown,
                                               String[] explicitListValues)
            {
                int rowNum = _currentRowIndex++;

                DVConstraint dc = CreateConstraint(operatorType, firstFormula, secondFormula, explicitListValues);

                HSSFDataValidation dv = new HSSFDataValidation(new CellRangeAddressList(rowNum, rowNum, 0, 0), dc);

                dv.EmptyCellAllowed = (allowEmpty);
                dv.ErrorStyle       = (errorStyle);
                dv.CreateErrorBox("Invalid Input", "Something is wrong - Check condition!");
                dv.CreatePromptBox("Validated Cell", "Allowable values have been restricted");

                dv.ShowPromptBox         = (inputBox);
                dv.ShowErrorBox          = (errorBox);
                dv.SuppressDropDownArrow = (suppressDropDown);


                _sheet.AddValidationData(dv);
                WriteDataValidationSettings(_sheet, _style_1, _style_2, ruleDescr, allowEmpty,
                                            inputBox, errorBox);
                if (_cellStyle != null)
                {
                    Row  row  = _sheet.GetRow(_sheet.PhysicalNumberOfRows - 1);
                    Cell cell = row.CreateCell(0);
                    cell.CellStyle = (_cellStyle);
                }
                WriteOtherSettings(_sheet, _style_1, promptDescr);
            }
Ejemplo n.º 2
0
            public void AddValidation(int operatorType, String firstFormula, String secondFormula,
                                      HSSFDataValidation.ERRORSTYLE errorStyle, String ruleDescr, String promptDescr,
                                      bool allowEmpty, bool inputBox, bool errorBox)
            {
                String[] explicitListValues = null;

                AddValidationInternal(operatorType, firstFormula, secondFormula, errorStyle, ruleDescr,
                                      promptDescr, allowEmpty, inputBox, errorBox, true,
                                      explicitListValues);
            }