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 members
| 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 |
Rule target ranges
As of 2.384.76, worksheet-local targets accept single cells, cell rectangles, whole columns such as $B:$D, and whole rows such as $5:$8; reversed endpoints are normalized, and spaces, tabs or line breaks separate multiple areas
Absolute and mixed references retain their original Range text; matching uses rows 1 through 1048576 and columns A through XFD, skips malformed or out-of-grid areas, and keeps valid sibling areas active without raising a new setter exception
Sheet-qualified and external references are not target areas; each rule belongs to its worksheet, and dollar signs must occur in ordinary A1 reference positions
Rule lookup, cell and range deletion, single-cell validation and stored-cell validation audits use the same target geometry; target parsing does not change list-source formula support
As of 2.384.77, row and column edits also transform whole-axis rule targets within the worksheet grid; an extent spanning every row or column remains complete when that axis is edited, while edits to the other axis move, shrink or remove the target
Range cloning retains the complete-coverage contract: every target area must fit inside the source rectangle before the rule is copied, and partial intersection alone does not copy a rule; whole-axis targets can be cloned from an entire-row or entire-column source when the destination stays within the grid
Whole-axis validation targets remain one rule during edits, with the formula adjusted from its first surviving anchor; this does not extend existing ODS custom-boolean or scalar-formula interoperability support
Example
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;
ODS scope
ODS export derives a valid first-cell base address from the first supported target area, including whole rows and columns; malformed leading areas do not become base addresses
Custom boolean validation export remains unsupported, and scalar threshold formulas retain their existing formula-syntax limitations; the target-range fix does not establish external interoperability for relative validation formulas
See also