TXLSXDataValidations manages Excel input constraints for TXLSXWorksheet.DataValidations and each rule is a TXLSXDataValidation
Declarations
function Add(const ARange: WideString; AType: TXLSXDataValidationType; AOp: TXLSXDvOperator; const AFormula1: WideString): Integer;
function Add(const ARange: WideString; AType: TXLSXDataValidationType; AOp: TXLSXDvOperator; const AFormula1, AFormula2: WideString): Integer;
function AddList(const ARange, AItems: WideString): Integer;
procedure TXLSXDataValidation.SetPrompt(const ATitle, AText: WideString);
procedure TXLSXDataValidation.SetError(const ATitle, AText: WideString; AStyle: TXLSXDvErrorStyle = xlsxDvErrStop);
Rule medlemmer
| Range and ValidationType | Target cells and the whole number, decimal, list, date, time, text-length or custom validation type |
| Op, Formula1 and Formula2 | Comparison operator and one or two criteria expressions |
| AllowBlank | Allows an empty value while retaining the validation rule |
| PromptTitle and Prompt | Input message shown when a target cell is selected |
| ErrorTitle, ErrorMessage and ErrorStyle | Invalid-entry alert and its stop, warning or information icon |
| ShowDropDown | Controls whether a list validation displays its selection arrow |
| ImeMode | OOXML IME input mode for supported CJK clients |
Eksempel
var Index: Integer;
begin
Index := Sheet.DataValidations.AddList('D2:D100', 'New,Active,Closed');
Sheet.DataValidations[Index].SetPrompt('Status', 'Select a permitted status');
Sheet.DataValidations[Index].SetError('Invalid status', 'Choose a value from the list');
end;
Se også