HotXLS documentation

XLSB data validation

The XLSX workbook facade reads, authors, edits and saves represented ordinary XLSB validation rules through the existing worksheet API; binary transport and candidate evaluation retain separate validation and resource checks

Ordinary rule profile

The supported kinds are input-only, whole number, decimal, list, date, time, text length and custom formula, with represented comparison operators and ordered worksheet-local target areas

Rules retain blank handling, prompt and error titles and messages, stop/warning/information alert styles, list dropdown visibility and known IME modes; these UI settings do not replace candidate evaluation

Use TXLSXWorksheet.DataValidations to edit or remove an imported rule, or the existing AddDataValidation, AddDecimalValidation, AddListValidation and AddCustomValidation helpers to author one

The complete workbook still passes the ordinary XLSB conversion gate; adding a supported validation rule does not enable an unrelated unsupported worksheet or package feature

Owner, anchor and candidate context

CheckDataValidation(Row, Col, Candidate, SetIfValid) tests every applicable rule in collection order and returns -1 for a valid candidate or no applicable rule, otherwise the 1-based index of the first failing rule

Formula references use the rule's owning worksheet rather than the workbook's active tab; relative coordinates move from the first valid target area's top-left anchor to the tested cell, while absolute row and column dimensions remain fixed

Custom predicates observe the proposed candidate through a temporary cell overlay, and ROW() and COLUMN() use the actual target; a read-only check restores the previous value and formula-cache state, and SetIfValid=True commits only after all applicable rules pass

Represented ordinary defined names and range-backed lists resolve in that owner context, with sheet-local names taking precedence over workbook-global names; list membership follows current source values instead of freezing the original item cache

Unresolvable or erroneous bounds and custom predicates fail the check; a failed or over-budget list evaluation does not establish membership, and an unevaluated formula is not silently accepted as proof of a valid input

AllowBlank controls an empty candidate before nonempty rule evaluation; input-only validation imposes no value constraint

Check and save an inactive owner's rules

This example keeps Sources active while Rules owns the constraints; B3 uses A3's bounds and the custom predicate reads Rules Z1

uses
  System.SysUtils, lxHandleX;

procedure SaveValidatedWorkbook(const OutputFile: WideString);
var
  Book: TXLSXWorkbook;
  Owner: IXLSXWorkbookOwner;
  Rules, Sources: TXLSXWorksheet;
begin
  Book := TXLSXWorkbook.Create;
  Owner := Book;
  try
    Rules := Book.Sheets.Add('Rules');
    Sources := Book.Sheets.Add('Sources');
    Book.Sheets.ActiveIndex := 1;
    Rules.Cells[2, 1].Value := 2;
    Rules.Cells[3, 1].Value := 4;
    Rules.Cells[1, 26].Value := 1;
    Sources.Cells[1, 26].Value := 100;
    Sources.Cells[1, 1].Value := 'Alpha';
    Sources.Cells[2, 1].Value := 'Beta';
    Book.DefinedNames.Add('ChoiceValues', '=Sources!$A$1:$A$2');

    Rules.AddDecimalValidation('B2:B3', xlsxDvOpBetween,
      '$A2', '$A2+0.5');
    Rules.AddDataValidation('D2:D3', xlsxDvList,
      xlsxDvOpBetween, 'ChoiceValues');
    Rules.AddCustomValidation('E2:E3', '$Z$1=1');

    if Rules.CheckDataValidation(3, 2, 4.25, True) <> -1 then
      raise Exception.Create('The relative decimal value should be valid');
    if Rules.CheckDataValidation(3, 2, 2.25, False) = -1 then
      raise Exception.Create('The value belongs to the wrong target row');
    if Rules.CheckDataValidation(2, 4, 'Alpha', True) <> -1 then
      raise Exception.Create('The named list should contain Alpha');
    if Rules.CheckDataValidation(2, 5, 'Candidate', False) <> -1 then
      raise Exception.Create('The rule must read Rules Z1');

    if Book.SaveAs(OutputFile, xlsxExcelBinaryWorkbook) <> 1 then
      raise Exception.Create('The XLSB output could not be saved');
  finally
    Owner := nil;
  end;
end;

Call SaveAs with xlsxExcelBinaryWorkbook for binary output, then use the ordinary Open path and the same public rule-checking APIs after reopening

Date systems and typed date candidates

A numeric date candidate is already a serial in the workbook's Date1904 system; the checker does not infer an epoch from a number format or reinterpret an ordinary Double as an OLE Automation date

For a Date validation rule, typed varDate candidates and typed date-valued formula bounds use the same epoch conversion as worksheet date serialization, so a DATE() bound and the candidate are compared in the same workbook date system

Focused controls cover numeric and typed 2026 dates in both 1900 and 1904 workbooks; the native-inspected 1904 output stores a date candidate as numeric 44562 under bounds DATE(2026,1,1) through DATE(2026,12,31)

Time-only numeric candidates remain fractions of a day, such as 0.375 for 09:00; this qualification does not establish every early-calendar phantom date or general date-arithmetic expression

Represented calculation context

The binary bridge preserves the public CalcMode values manual, auto and autoNoTable, together with CalcCompleted and CalcOnSave, in both directions

This includes the independent native validation fixture's manual mode with both flags false; validation checking does not manufacture a calculation-engine revision, and CalcId retains its existing signed public-model boundary

Iteration, reduced precision, alternate reference mode, explicit thread settings and other unrepresented calculation options retain their conversion gates

Without an explicit user thread setting, the writer normalizes the unused binary thread-count field to its specified value of 1; older unused zero remains readable, and whole-record byte identity is not promised

Short literal-list compatibility

The independently authored ordinary short literal list is stored as a sole PtgStr containing comma-separated UTF-16 text, without NUL substitution or ancillary formula data

The published DVParsedFormula list-root rule requires a non-VALUE root, while the observed native PtgStr is a VALUE root; this backend makes an explicit bounded compatibility exception for that short literal form

This exception does not accept arbitrary VALUE expressions as list sources and does not qualify long-list alternate content, embedded-comma item escaping or NUL-separated list encodings

The observed ordinary unused bit is not used as the sole discriminator for accepting a literal list

Identity annotations and unknown content

The recognized ordinary UID alternate-content envelope carries a 16-byte rule annotation and does not establish a public consumer identity, relationship or stable identifier; that source UID is not promised to survive output

Direct binary conversion refuses unknown alternate-content envelopes or records, repeated identity records, DVal14, BrtDValList record 681, unknown IME modes and nondefault collection-level prompt flags or coordinates; checked saving refuses unsupported rules that remain represented in the public model

The older generic OOXML parser still skips unrecognized validation type tokens; this increment does not retain every unknown XML rule for later checked-save diagnosis, and a rule already absent from the model cannot be reconstructed by output preflight

Explicit and default input-only none rules are retained with their prompts instead of being dropped on import

Conversion and execution bounds

Ordinary conversion permits at most 65534 rules and 8191 target rectangles per rule, subject to the existing worksheet grid and source-part limits

Validation metadata has a charged 16 MiB ceiling; encoded formula tokens are limited to 16384 bytes, formula text to 8192 characters and the validation expression stack to 1024 entries

Prompt and error titles have a 32 UTF-16 code-unit limit, the error message has a 225 code-unit limit and the input prompt has a 255 code-unit limit; short string tokens are limited to 255 UTF-16 code units

Formula execution uses the default bounded evaluation options and the workbook's unsafe-callback setting with external resolution disabled; list results must be scalar or one/two dimensional and inspect at most 1048576 entries, without promising a hard total-memory or wall-clock ceiling for arbitrary caller callbacks

Unsupported or malformed selected binary content rejects through the existing preflight and private package-staging path; it does not gain a direct write path that bypasses destination protection

Representative qualification

Representative Delphi Win64 qualification covers 590 public lifecycle assertions, the unchanged nine-context counterexample driver, five date controls, 25 bounded/refusal checks, eleven name checks and 57 independent wire checks

Five public outputs, comprising preserved XLSB and XLSX files plus edited, authored and deleted-rule workbooks, pass the owned Excel acceptance with 663 checks, 131 candidate judgments and 34 observed rules

The separate 1904-date XLSB output passes its own native acceptance with 33 checks, four candidate judgments and one rule; these results are additional to the five-file ordinary qualification

The named-list qualification inspects the definition's actual binary reference class, target worksheet and range bounds, since normalizing a value-class name to the same formula text in a self round trip did not establish native execution

These checks qualify the represented ordinary profile on the tested Windows path and do not establish untested platforms or all validation extensions

Remaining worksheet-feature scope

Future/UDF calls, external-book dependencies, spill or implicit-intersection operators, array constants and unrepresented validation control or ancillary token forms remain outside this ordinary profile; name references do not authorize unsupported dependency forms

Data validation belongs to the broader finite XLSB worksheet profiles; rich text, Notes, conditional formatting, advanced filters and table calculations and custom styles have separate qualified subsets and documented conversion boundaries

Ordinary rule support does not establish every native extension, every platform or completion of the full worksheet-feature scope

Long literal lists load beyond the 255-character authoring limit: the binary token length is bounded only by its u16 field, matching a native 419-character single-token list; Excel itself refuses to reopen xlsx literal lists longer than 255 characters, so the long xlsx form is verified library-side while the binary form carries the native round-trip

Extension data validations (for example lists referencing another worksheet) parse into the typed DataValidations model flagged IsExtension: their cross-sheet formula and range survive edits, saves and reopens together with the input prompt, error alert title, message and style, the hidden in-cell dropdown setting and the IME mode, and the writer re-emits them as the x14 extension in its schema position with the same escaping and default omissions as ordinary rules; replayed extension fragments also declare every namespace prefix they use on the worksheet root

Extension validation formula bounds

Typed x14 whole-number, decimal, text-length, date and time validations retain both formulas for between and notBetween rules through saving and reopening, including represented cross-sheet formula references; this is persistence in the existing extension profile and does not add a new validation evaluator

A dataValidation with an unrecognized type token loads as an untyped rule with one warning diagnostic instead of being dropped, and resaves in the bare-element form native Excel itself rewrites such rules into