HotXLS Docs

Additional library API members

This page completes the reference for public types that support the primary workbook, worksheet, rendering, import, diagnostics, and viewer APIs but which do not need a separate task-oriented guide

Filtering and conditional formatting

TXLSAutofilterAdd, AddAutofilterData, AssignFrom, Clear, and ParseAutofilterData edit or import the filter definition; SetRangeBounds(ARow1, ACol1, ARow2, ACol2) restores 1-based inclusive bounds whilst keeping loaded criteria and dropdown shapes, and disregards nonpositive or reversed bounds plus a column count that differs from the loaded fields; Defined, FirstRow, FirstCol, LastCol, LastRow, and FieldCount expose its active bounds and filtered-column count
TXLSAutofilterItemShape exposes the filter-button drawing linked to the item, and the loaded filter criterion is available as a TXLSAutofilterDOPER operand record — DataType selects the operand form and grbitSgn carries the sign and flag bits — for inspection or round-trip editing
TXLSDataBarSpecAxisColor, AxisIsThemeColor, AxisThemeColorId, AxisThemeColorTint, and ClearAxisThemeColor control the axis; Direction, GradientFill, NegativeBarBorderColorSameAsPositive, NegativeBarColor, NegativeBarColorSameAsPositive, and NegativeBorderColor control bar appearance; IsIndexedColor, IndexedColorIndex, and ClearIndexedColor manage the palette-index bar colour
TXLSIconSetSpecThresholdEqualsInclude selects inclusive or exclusive comparison for each icon threshold
TXLSCfValueIsIndexedColor and IndexedColorIndex report a threshold colour stored as a legacy palette index, ClearIndexedColor removes that form again, and theme or literal colours remain available through the existing accessors

TXLSCfValue, TXLSDataBarSpec, TXLSColorScaleSpec, TXLSIconSetSpec, and TXLSDxfStyle accept AttachWriteGuardOwner, attaching the rule object to its owning workbook so edits acquire a write guard automatically; the owner implements TXLSCondFormatWriteGuardOwner, whose single AcquireWriteGuard method hands the rule the workbook's write guard. TXLSDxfStyle adds FontColorIndex with FontColorIsIndexed plus the FillFgColorIndex / FillFgColorIsIndexed and FillBgColorIndex / FillBgColorIsIndexed pairs for palette-index rule colours, and the differential-font overrides FontName, FontSize, and FontScheme (empty string, a point size, or a theme font slot such as major / minor) alongside the existing bold, italic, underline, and colour members; each assignment acquires the write guard and marks the rule dirty for re-emission

TXLSConnections, TXLSDataTables, and TXLSQueryTables expose OnAcquireWriteGuard (type TXLSConnectionAcquireWriteGuard, TXLSDataTableAcquireWriteGuard, and TXLSQueryTableAcquireWriteGuard), the hook their edit paths use to obtain the owning workbook's IXLSWorkbookWriteGuard before mutating and to advance the workbook generation afterwards; the guard logs StartGeneration, and Complete marks the write finished so dependent caches can rebuild

Preserved data connections carry a typed description: TXLSConnectionKind (xlckUnknown, xlckOdbc, xlckDao, xlckFile, xlckWeb, xlckOleDb, xlckText, xlckAdo) classifies the connection, TXLSConnectionCredentials (xlccIntegrated, xlccNone, xlccStored, xlccPrompt) records its authentication mode, and every connection parameter value is tagged with TXLSConnectionParameterValueKind (xlcpvNone, xlcpvBoolean, xlcpvDouble, xlcpvInteger, xlcpvString, xlcpvCell). What-if data tables report their stored definition kind through TXLSDataTableKind

What-if data tables and pivot grouping

TXLSDataTableAssign, ContainsCell, and IsRoot copy and inspect a table; Kind, FirstRow, FirstCol, LastCol, LastRow, AlwaysCalculate, ColumnInputCol, ColumnInputRow, ColumnInputDeleted, RowInputCol, RowInputRow, and RowInputDeleted expose the stored calculation definition
TXLSDataTablesAdd, AddExisting, Delete, Clear, Assign, AdjustForShift, and Offset maintain the collection; FindByCell and FindRoot locate the table containing or rooted at a given cell; Count, Items, and OnChange expose collection state
TXLSPivotCacheFieldGroupBaseField and GroupParentField expose the relationships between a grouped field and its source or parent field

Icon-set thresholds can be rendered or validated programmatically: XLSCfIconSetCount reports how many icons a TXLSIconSetType defines, and XLSBuildCfIconGeometry fills a TXLSCfIconGeometry with the primitives (TXLSCfIconPrimitive, kind TXLSCfIconPrimitiveKind: cfipPolygon, cfipEllipse, cfipRect, cfipLine) and points (TXLSCfIconPoint) that draw one icon, so custom renderers match Excel's built-in icon shapes

Diagnostics, formula tracing, and validation

TXLSDiagnosticCode, NativeCode, Message, Severity, ExceptionClass, PartName, RecordId, SheetIndex, SheetName, and StreamOffset identify one parser, writer, or package diagnostic
TXLSDiagnosticsAdd appends a diagnostic, Clear resets the collection, and Count plus Items enumerate its entries
TXLSDiagnosticSeverity and TXLSDiagnosticOperationTXLSDiagnosticSeverity (xlsDiagnosticInfo, xlsDiagnosticWarning, xlsDiagnosticError, xlsDiagnosticFatal) classifies one diagnostic and TXLSDiagnosticOperation (xlsOperationNone, xlsOperationOpen, xlsOperationSave, xlsOperationCalculate, xlsOperationExport) names the phase that produced it; OnDiagnostic handlers read both from the delivered TXLSDiagnostic
TXLSFormulaDebugSessionCurrentStep, DependencyCount, NodeCount, and StepCount expose the current debugger snapshot and its trace sizes
TXLSFormulaTracerStepCount reports the number of recorded evaluation steps
TXLSImportCheckAddRule, AddUniqueRule, and AddCrossColumnRule configure column predicates, composite uniqueness, and typed comparisons; Check returns structured violations from stored worksheet values and formula caches without recalculation or packed-cell materialisation; HeaderRow, FirstRow, LastRow, OnVerifyCell, ViolationCount, and Violation expose bounds, callbacks, and results; Annotate and KeepOnlyViolations are explicit correction-workbook operations; see import validation schemas for types, bounds, date systems, tuple identity, and failure behaviour

Import validation schemas

TXLSImportCheck from lxImportCheck validates a TXLSXWorksheet against rules owned by the application; it inspects stored scalar values and stored formula results, with one-based worksheet coordinates and no implicit text-to-number, text-to-date, or text-to-Boolean conversion

Validator := TXLSImportCheck.Create;
try
  Validator.HeaderRow := 1;
  Rule := Validator.AddRule(2);
  Rule.Name := 'quantity';
  Rule.Flags := [irRequired, irValueType, irValueRange];
  Rule.ValueKind := ivkInteger;
  Rule.MinimumValue := 1;
  Rule.MaximumValue := 1000;

  Validator.AddUniqueRule([1, 3]).Name := 'account-and-region';
  Validator.AddCrossColumnRule(4, 5, icLessOrEqual).Name := 'start-before-end';
  FailureCount := Validator.Check(Sheet);
  if FailureCount > 0 then
    Validator.Annotate(Sheet, 'Import validator');
finally
  Validator.Free;
end;

HeaderRow > 0 starts checking at the next row and takes precedence over FirstRow; otherwise FirstRow defaults to 1; LastRow = 0 uses the worksheet's last used row, whilst a positive LastRow can include absent cells without creating them; columns must lie within 1 through 16,384 and active data-row bounds within 1 through 1,048,576

Column rules and explicit types

TlxImportColumnRuleColumn, Flags, Name, Title, MinLength, MaxLength, Pattern, ValueKind, and DateSerialMode configure one column; MinimumValue, MaximumValue, HasMinimum, HasMaximum, MinimumInclusive, and MaximumInclusive configure bounds; Validate checks schema configuration and PreparePattern prepares the regex; the two Check overloads return a Boolean with an error message and optionally a TlxImportViolationKind
TlxImportRuleFlagsirRequired, irTextLength, irPattern, irUnique, and irCallback retain their existing checks; irValueType enables ValueKind and irValueRange enables the configured bounds; a column with no flags is not checked
TlxImportValueKindivkAny accepts supported finite scalar values, ivkNumber accepts finite numeric Variants, ivkInteger additionally requires an integral value, ivkDate accepts date Variants or explicitly enabled Excel serials, ivkBoolean requires a Boolean Variant, and ivkText requires a string Variant
TlxImportDateSerialModeidsNone is the default and keeps numeric values distinct from dates; idsExcel1900 and idsExcel1904 explicitly interpret numeric values for a column using irValueType with ValueKind = ivkDate

AddRule(Column) replaces and frees any previous rule for that column; the per-value type, range, length, and pattern predicates skip missing values, nulls, and empty strings, whilst irRequired reports them; uniqueness retains the distinct policies described below; nonempty whitespace still counts as a value; a number does not qualify as a Boolean, a date does not qualify as an ordinary number, and a numeric-looking string stays text

Assigning MinimumValue or MaximumValue enables that bound; either HasMinimum or HasMaximum can disable it again; both inclusivity switches default to True; bounds must be finite typed numbers or dates, and two bounds must be comparable and describe a nonempty interval; reversed, missing, incompatible, or empty bounds raise before any worksheet validation starts

Number bounds compare numeric values whilst date bounds compare dates; integer-to-integer comparisons preserve all Int64 and UInt64 bits; values of an incompatible category fail the range check; text length and regex predicates continue to inspect the scalar's text representation, and regex checks retain the existing IsMatch behaviour, so use anchors such as ^...$ when the complete text must match; an invalid regex turns off its pattern check for compatibility

Date-formatted Excel values

A cell imported from Excel can contain a numeric serial even when its number format displays a date; choose a serial mode explicitly when the accepted import schema calls for one; the mode affects validation only and never alters the stored cell value

Rule := Validator.AddRule(4);
Rule.Flags := [irRequired, irValueType, irValueRange];
Rule.ValueKind := ivkDate;
if Sheet.Workbook.Date1904 then
  Rule.DateSerialMode := idsExcel1904
else
  Rule.DateSerialMode := idsExcel1900;
Rule.MinimumValue := VarFromDateTime(EncodeDate(2026, 1, 1));
Rule.MaximumValue := VarFromDateTime(EncodeDate(2026, 12, 31));

VarFromDateTime is declared in Variants and EncodeDate in SysUtils; numeric serials must be nonnegative and resolve before January 1, 10000; fractional serials retain their time-of-day; the 1900 system rejects every serial from 60 inclusive through 61 exclusive since that interval denotes the fictitious leap day; the 1904 system maps serial zero to January 1, 1904

Date bounds include the time of day, so a maximum set to midnight on December 31 excludes later times on that day; use an exclusive upper bound at January 1 of the following year when the whole of the final day must be accepted; textual dates such as 10/08/2026 remain text regardless of the configured serial mode

Composite uniqueness and cross-column comparisons

AddUniqueRule(const AColumns: array of Integer): TlxImportUniqueRuleAdds an independent tuple constraint across an ordered, nonempty list of distinct columns; Name identifies the rule, Title prefixes its message, ColumnCount and zero-based Columns[Index] expose its members, and SkipIncompleteRows defaults to True
AddCrossColumnRule(ALeftColumn, ARightColumn: Integer; AComparison: TlxImportComparison): TlxImportCrossColumnRuleAdds a same-row comparison with read-only LeftColumn and RightColumn, an editable Comparison, Name, Title, and SkipBlankValues, which defaults to True
TlxImportComparisonicEqual, icNotEqual, icLess, icLessOrEqual, icGreater, and icGreaterOrEqual select the relation; numeric pairs and date pairs compare their values, Boolean pairs order False before True, and string pairs compare case-sensitive UTF-16 code units in ordinal order

Composite keys retain each member's exact Variant type and text identity; Integer(1), Double(1), the string '1', a Boolean, and a date are distinct members; there is no case folding, Unicode normalisation, locale parsing, or delimiter ambiguity; combinations such as ('ab', 'c') and ('a', 'bc') remain different; each validation pass starts a fresh tuple index

When SkipIncompleteRows = True, a missing, null, or empty-string member leaves that row out of tuple uniqueness; setting it to False includes those members with their original Variant identities; a duplicate reports the first tuple column as its cell address together with the first matching row via FirstDuplicateRow

The existing single-column irUnique retains its text-based, case-insensitive matching behaviour and skips missing or null values; use AddUniqueRule([Column]) when strict typed identity is required for one column

Cross-column comparisons never coerce strings to numbers, numbers to Booleans, or ordinary numbers to dates; mismatched incompatible categories fail even for icNotEqual; string comparisons distinguish composed and decomposed Unicode, preserve embedded null characters, and order shorter prefixes first; when SkipBlankValues = False, either blank operand produces a cross-column violation

Structured results and correction workbooks

TlxImportViolationRow, Col, SheetName, and Address identify the cell, with Address in A1 notation; ValueText and ErrorText carry display information; RuleName and Kind identify the configured rule and failure category; RelatedColumn identifies the second operand for a cross-column failure and FirstDuplicateRow identifies the original row for uniqueness failures
TlxImportViolationKindivRequired, ivTextLength, ivPattern, ivUnique, ivCallback, ivValueType, ivValueRange, ivCellError, ivFormulaCacheMissing, ivCompositeUnique, and ivCrossColumn distinguish supported failure categories

Check(Sheet) returns the number of violations, and ViolationCount plus zero-based Violation(Index) enumerate the report; one column rule reports its first failing predicate, whilst independently configured tuple and comparison rules can add further violations for the same cell; assign meaningful Name values when callers need stable application rule identifiers

Formula cells are validated from their stored cached values; a formula lacking a stored cached result reports ivFormulaCacheMissing, and an error result reports ivCellError; explicitly recalculate before checking when fresh formula results are required; validation never reaches external sources, alters formula definitions, or evaluates uncached formulas

OnVerifyCell retains the TlxImportVerifyCell callback signature and runs after successful applicable column predicates and uniqueness checks; it returns a Boolean and can set an application error message; callbacks must keep the workbook and validation schema unchanged, and workbook writes are refused by the read lease; callback exceptions propagate and the lease is freed again for subsequent operations

Check never annotates, deletes rows, or materialises packed values; use Annotate after checking to apply red fonts and append error text to existing comments, or else explicitly call KeepOnlyViolations to remove nonviolating rows and create a correction workbook; these methods alter the supplied worksheet, so call them on the intended workbook after studying the report

Validation borrows the worksheet and workbook for the synchronous call; it does not take over the caller's object ownership or require an interface-owned workbook; a read lease shields the relevant stored-cell snapshots and stored formula-cache access throughout the check

TXLSExternalLinkUpdateMode = (xluPromptUser, xluNever, xluAlways);

property IXLSWorkbook.SaveExternalLinkValues: Boolean;
property IXLSWorkbook.UpdateLinks: TXLSExternalLinkUpdateMode;
property TXLSXWorkbook.SaveExternalLinkValues: Boolean;
property TXLSXWorkbook.UpdateLinks: TXLSExternalLinkUpdateMode;
      
Both engines default to saving cached values and to xluPromptUser; xluNever and xluAlways only change the update preference stored in the workbook and never authorise or initiate external file or network access

Calculation audit and workbook hints

function TXLSWorkbook.RecalcAndVerify(MaxIssues: Integer = 10000): TXLSCalculationAuditReport;
function TXLSXWorkbook.RecalcAndVerify(MaxIssues: Integer = 10000): TXLSCalculationAuditReport;
function TXLSWorkbook.RecalcAndVerifyEx(const Options: TXLSRecalcAuditOptions): TXLSCalculationAuditReport;
function TXLSXWorkbook.RecalcAndVerifyEx(const Options: TXLSRecalcAuditOptions): TXLSCalculationAuditReport;
function TXLSWorkbook.RunCalculationAudit(const Options: TXLSRecalcAuditOptions): TXLSCalculationAuditReport;
function TXLSWorkbook.FormulaIsVolatile(Formula: WideString): Boolean;

function TXLSWorkbook.AuditOverlayHash(SheetIndex, Row, Col: Integer): Integer;
function TXLSWorkbook.AuditOverlayRead(SheetIndex, Row, Col: Integer; var Value: Variant): Boolean;
procedure TXLSWorkbook.AuditOverlayWrite(SheetIndex, Row, Col: Integer; const Value: Variant);
procedure TXLSWorkbook.AuditOverlayClear;

TXLSCalculationAuditIssueKind = (xlcaiCacheMismatch, xlcaiParseFailure,
  xlcaiMissingFunction, xlcaiMissingName, xlcaiUnsupportedArguments,
  xlcaiCircularReference, xlcaiExternalReferenceDenied,
  xlcaiExternalReferenceMissing, xlcaiDataTableSkipped, xlcaiCancelled,
  xlcaiInternalFailure);

TXLSCalculationAuditIssue = record
  Kind: TXLSCalculationAuditIssueKind;
  SheetIndex: Integer;
  SheetName: WideString;
  Row: Integer;
  Col: Integer;
  Formula: WideString;
  Symbol: WideString;
  Expected: Variant;
  Actual: Variant;
  ResultCode: Integer;
  Stack: WideString;
  ExternalTarget: WideString;
end;
TXLSCalculationAuditIssues = array of TXLSCalculationAuditIssue;

TXLSRecalcAuditProgress = procedure(ASender: TObject;
  ACurrent, ATotal: Integer; var ACancel: Boolean) of object;

property WorkbookCodeName: WideString;
property CalculationThreadMode: TXLSCalculationThreadMode;
property ForceFullCalculationState: TXLSOptionalBooleanState;
property RefreshAllOnLoadState: TXLSOptionalBooleanState;
      
RecalcAndVerify combines formula-symbol failures and cached-value mismatches into stable structured categories with worksheet coordinates, formulas, symbols, expected and actual values, and bounded truncation whilst leaving caches and workbook semantics unchanged. RecalcAndVerifyEx runs the deep audit: it evaluates every formula once via the dependency graph into an isolated result overlay so dependent cells read this pass rather than stale caches, classifies evaluation failures (unsupported arguments, circular references, denied or missing external references, data tables skipped, cancellation, internal failures) with result codes, records a bounded call stack per failure, honours an issue budget and a progress/cancel sink, and stays read-only unless ApplyResults commits the recomputed values atomically after a fully successful pass across an unchanged workbook structure
AbsoluteTolerance and RelativeTolerance control mismatch reporting rather than intermediate calculation values or explicit cache application For numeric results, a mismatch requires an absolute difference above AbsoluteTolerance and, when relative tolerance is enabled, above RelativeTolerance * max(abs(Expected), abs(Actual)) Equality at either threshold is allowed; changed values still enter the audit overlay so dependent formulas see the current calculation, and ApplyResults commits those values even when their differences are not reportable A read-only audit never alters stored caches
Each element of TXLSCalculationAuditReport.Issues is a TXLSCalculationAuditIssue; Kind selects one of the xlcai* categories, Expected / Actual carry the compared values for cache mismatches, Stack is the bounded evaluation call chain rendered as Sheet!A1 > Sheet!B2 (outermost frame first), and ExternalTarget describes the external workbook for external-reference issues. TXLSRecalcAuditOptions.OnProgress is a TXLSRecalcAuditProgress sink that receives ACurrent / ATotal node progress and can set ACancel to stop the audit at the next node boundary with a single xlcaiCancelled issue
RunCalculationAudit is the engine entry the workbook-level audit wrappers delegate to, and it accepts the same options record. FormulaIsVolatile reports whether a formula would force a recalculation on each pass (calls such as NOW, RAND, TODAY, OFFSET, INDIRECT, or an unresolvable reference)
The audit overlay is a what-if layer on top of the cell caches: AuditOverlayWrite stores a replacement value for one cell (1-based sheet index, 0-based row and column following the calculator convention), AuditOverlayRead and AuditOverlayHash query it, and AuditOverlayClear empties the layer. Overlaid values come back from the normal cell-value getters, so recalculation and the deep audit observe them without mutating worksheet cells; clearing the overlay restores the stored values
The workbook hint properties retain missing, false, true, disabled, automatic, and manual states where the source format supports them; they never trigger calculation, refresh, file-system, network, or database work on open

Table formula and IME state

property TXLSXTable.ColumnCalculatedFormulaArrayStates[Index: Integer]: TXLSTableFormulaArrayState;
property TXLSXTable.ColumnTotalsFormulaArrayStates[Index: Integer]: TXLSTableFormulaArrayState;
property TDataValidation.ImeMode: TXLSDataValidationImeMode;
property TXLSXDataValidation.ImeModeKind: TXLSDataValidationImeMode;
      
Calculated-column and totals-row formulas keep independent absent, false, true, or unknown array states, including untouched source lexical values and column structural edits; array formulas are rejected by scalar row expansion rather than being silently changed
IME modes use explicit BIFF and OOXML mappings, preserve unknown source values, and refuse the OOXML-only disabled value when authored for Classic XLS
Setting SaveExternalLinkValues to False omits Classic XCT and CRN records or the XLSX external-book sheetDataSet subtree, whilst retaining link targets, sheet names, external defined names, relationships, formula references, unknown XML, and the in-memory cache; restoring the property to True on the same workbook can serialise that retained cache again
Untouched unsupported source tokens remain byte-for-byte or lexically preserved, explicit assignments emit only legal values, unchanged XLSX parts keep the compressed-copy path, and XLS/XLSX conversion transfers both policies; ODS and text workbooks have no equivalent declaration and open with the defaults, whilst preserved DDE and OLE link parts are not treated as external-workbook cell caches

Web Add-in task pane inspection and removal

function IXLSWorkbook.HasWebAddinTaskPanes: Boolean;
function IXLSWorkbook.WebAddinTaskPaneCount: Integer;
function IXLSWorkbook.RemoveWebAddinTaskPanes: Integer;
function TXLSXWorkbook.HasWebAddinTaskPanes: Boolean;
function TXLSXWorkbook.WebAddinTaskPaneCount: Integer;
function TXLSXWorkbook.RemoveWebAddinTaskPanes: Integer;
      
The inspection methods recognise only internal package-root relationships whose type exactly matches the Web Add-in task pane relationship type; external relationships, differently cased types, worksheet relationships, and similarly named parts are ignored
Removal first validates the complete relationship graph, including normalised targets, package-root confinement, cycles, missing parts, and resource limits; it then removes all matching root relationships and only the reachable parts not shared by another retained relationship, together with relationship parts owned by deleted sources
The operation is atomic and idempotent, removed source parts cannot reappear through compressed-copy saving, and content types are rebuilt from whatever remains of the package; malformed graphs add diagnostic code 1303 and raise an exception before mutation, whilst Classic XLS and ODS return False, 0, and -1 without package scanning

Workbook object display policy

TXLSObjectDisplayMode = (xlsodmShowAll, xlsodmShowPlaceholders,
  xlsodmHideAll);

property IXLSWorkbook.ObjectDisplayMode: TXLSObjectDisplayMode;
property TXLSWorkbook.ObjectDisplayMode: TXLSObjectDisplayMode;
property TXLSXWorkbook.ObjectDisplayMode: TXLSObjectDisplayMode;
property TXLSPaginationModel.ExportObjectPlaceholders: Boolean;
property TXLSPDFExport.ExportObjectPlaceholders: Boolean;
property TXLSSvgExport.ExportObjectPlaceholders: Boolean;
property TXLSPageImageExporter.ExportObjectPlaceholders: Boolean;
property TXLSPrintDocument.ExportObjectPlaceholders: Boolean;
property TXLSXHtmlExportOptions.ExportObjectPlaceholders: Boolean;
      
Classic XLS maps the three states onto its workbook object-display record and XLSX maps them to workbookPr.showObjects; missing values default to xlsodmShowAll, untouched reserved Classic payloads and unsupported XLSX tokens stay lossless, and explicit assignments emit only canonical values
The viewer renders placeholder mode as lightweight boxes carrying available object type, name, text, and alternative text; exporters retain full objects by default, whilst setting ExportObjectPlaceholders requests the same low-cost policy without decoding image payloads or building chart scenes
xlsodmHideAll prevents drawing collection and object-driven range expansion before rendering begins; workbook conversion transports all three states, ODS writes complete drawings for placeholder mode and omits drawing and media output for hide-all mode, and worksheet backgrounds remain independent

Render calibration values and snapshots

TXLSRenderCalibration = record
  WidthCorrection: Double;
  HeightCorrection: Double;
  LineSpacing: Double;
  CellMarginFactor: Double;
  ScreenScaling: Integer;
  MeasurementDpi: Integer;
end;

function XLSDefaultRenderCalibration: TXLSRenderCalibration;
function XLSValidateRenderCalibration(const AValue: TXLSRenderCalibration;
  out AInvalidField: TXLSRenderCalibrationField): Boolean;
      
The default values are 1, 1, 1, 1, 100, and 96; width and height corrections must be greater than zero and smaller than two, line spacing is bounded to (0, 4], cell margins to [0, 4], screen scaling to [100, 500] percent, and measurement DPI to [36, 2400]
Classic XLS and XLSX workbooks expose the same RenderCalibration, CaptureRenderCalibration, and ResetRenderCalibration members; whole-record assignment validates before mutation, and each capture gives back an independent immutable-by-convention value snapshot for one rendering operation

Render geometry and font measurement

TXLSRenderGeometryBackend = (xlsrgbAutoFit, xlsrgbPagination, xlsrgbPdf,
  xlsrgbSvg, xlsrgbBitmap, xlsrgbPrintPreview, xlsrgbViewer, xlsrgbHtml);

TXLSRenderFont = record
  Name: WideString;
  Size: Double;
  Styles: TXLSRenderFontStyles;
  Charset: Byte;
end;

function CreateXLSRenderGeometry(
  const ACalibration: TXLSRenderCalibration;
  AWorkbookGeneration: UInt64;
  ABackend: TXLSRenderGeometryBackend;
  ACacheCapacity: Integer = 4096): IXLSRenderGeometry;

property TXLSHTMLExport.RenderGeometry: IXLSRenderGeometry;
property TXLSXHtmlExportSession.RenderGeometry: IXLSRenderGeometry;
      
IXLSRenderGeometry owns one immutable calibration, workbook generation, backend identity, a measurement service, and bounded operation-local metric cache; CreateXLSRenderGeometry uses GDI, whilst CreateXLSPortableCairoRenderGeometry in lxPortableCairo uses explicit font bytes with FreeType/HarfBuzz on native Linux or macOS; MeasureText returns pixel width, height, line height, ascent, descent, and line count whilst MaximumDigitWidthPixels, ColumnWidthToPixels, PixelsToColumnWidth, PointsToPixels, PixelsToPoints, and UsableCellWidthPixels provide the shared geometry conversions
Cache identity covers backend, workbook generation, all calibration values, font name, exact size, styles, charset, wrap width, and text; width and height correction get applied once during text measurement, line spacing affects only multi-line height, cell-margin correction affects only usable text width, and screen scaling affects only maximum-digit-width emulation for implicit column widths
Classic XLS and XLSX AutoFit capture a single service for each public operation, including merged-range and two-phase MarkSheet measurement, whilst TXLSPaginationModel.Build captures one service for the selected RenderBackend; PDF, SVG, bitmap, print-preview, workbook-viewer, and HTML entry points select their own backend ahead of output, changing workbook calibration cannot mutate an existing snapshot, and output never writes worksheet dimensions
Direct HTML workbook, worksheet, and range calls capture a fresh xlsrgbHtml service, whilst an incremental TXLSXHtmlExportSession captures once in BeginExport and reuses that snapshot for every sheet; both exporters expose the retained service through RenderGeometry for calibration and cache diagnostics
The read-only IXLSRenderGeometry properties WorkbookGeneration, CacheCapacity, and CacheEntryCount report the bound generation and cache fill for diagnostics, and ImplicitWidthMaximumDigitWidthPixels returns the digit-width measurement behind implicit column-width emulation
MeasureText fills a TXLSRenderTextMetrics record (pixel width, height, line height, ascent, descent, and line count) out of a TXLSRenderFont whose Styles member is a set of TXLSRenderFontStyle flags (bold, italic, underline, strikethrough)

Import, code generation, comparison, and monitoring

TXLSHTMLImportLoadFromHTML overloads import HTML table content from a stream or file into a worksheet, with optional start coordinates, table selection, and a decimal separator
TXLSCodeGenLanguage (type TlxCodeGenLanguage: lcgDelphi or lcgCppBuilder) selects the source dialect of the generated statements, GenerateToList writes generated workbook code to a string list, and TlxCodeGenOptions widens the output with merges, column widths, or number formats (cgoMerges, cgoColumnWidths, cgoNumberFormats; sheets and cells are always emitted)
TXLSXWorkbookCompareCompare compares typed stored cells, formula text, sheet presence, and merges; Options adds formula caches, base cell styles, and row or column geometry, SetNumericTolerance configures numeric equality, and Count, Diff, and Report expose the ordered results; see workbook comparison
TXLSFileMonitorIntervalMs selects the polling interval and SynchronizeEvent selects synchronised callback delivery; an OnFileChanged handler may deactivate or destroy the monitor, or change FileName to start watching another file
TXLSCSVLoader and TXLSCSVSaverThe loader parses delimited text into an in-memory grid of Variants — ParseFile and ParseStream fill the grid, CellValue, RowCount, and ColCount read it back — with auto-detected separator (ValueSeparator) and encoding (TXLSCsvEncoding: system ANSI, UTF-16, UTF-8) and optional type promotion controlled by DetectTypes and per-column ColumnTypes entries (TXLSCsvColumnType: auto, text, number, date, boolean, skip); SkipRows, AutoTrim, LocaleTolerantNumbers, and FieldWidths refine fixed-width and locale handling. TXLSCSVSaver.SaveAs writes the grid back with RFC 4180 quoting, and QuoteAllStrings forces quoting; TXLSTSVSaver derives from the saver for tab-separated output

Workbook comparison

TXLSXWorkbookCompare in lxCompare compares two TXLSXWorkbook instances without recalculating formulas or modifying either workbook; sheets are paired by case-insensitive name, and sheet order changes on their own do not produce a difference

The default Options value is empty and both tolerances default to zero; default comparison reports added or removed sheets, added or removed stored cells, changed typed literal values, changed formula text, and merged ranges that were added or removed

Literal comparison tells numbers, text, Boolean values, dates, errors, and blanks apart: the number 1 differs from the text '1', a Boolean differs from its text spelling, dates retain their own type, and errors compare by their stored error code; numeric storage types with equal values compare equally, whilst distinct Int64 values remain distinct during exact comparison

lcoFormulaCachedResultsFor cells whose formula text matches, compares the existing cached result and tells a missing or invalidated cache apart from an available one; loaded and calculated caches holding the same typed value compare equally
lcoCellStylesCompares resolved base styles at matching stored-cell coordinates, including fonts, fills, gradients, borders, alignment, number formats, and cell protection; unrelated style-pool insertion order does not create differences, and theme colours resolve against each workbook's current theme
lcoAxisGeometryCompares effective row heights, column widths, hidden flags, outline levels, collapsed flags, and worksheet defaults; an explicit size matching the effective default compares equally with an implicit size
lcoDefinedNamesCompares workbook and worksheet scoped names, their formula definitions, visibility, comments, and macro flags; scope follows worksheet names, and insertion order never creates differences
lcoDataValidationsCompares validation definitions in stored order, including normalised target ranges, formulas, operators, prompts, error messages, and control flags; changing the order of target ranges within one definition does not create a difference
lcoConditionalFormatsCompares conditional-format definitions in stored order, including effective priority, stop-if-true behaviour, target ranges, formulas, differential styles, and supported colour-scale, data-bar, and icon-set settings; style-pool and indexed-palette identifiers resolve to their semantic values
lcoTablesPairs tables by name and compares ranges, headers, totals, style settings, comments, column names, labels, formulas, array flags, unique names, connection names, filter criteria, and sort conditions; table IDs, column IDs, and insertion order do not create differences, whilst colour-filter and sort differential-style IDs resolve to appearance
lcoDrawingsCompares typed drawing definitions in drawing order, retaining group-child order and chart plot-group order; supported canonical definitions span images, text boxes, charts, groups, complete typed slicer views, and typed timeline views, and opaque or unsupported drawing nodes raise EXLSSemanticSnapshot
lcoBlankStyleRegionsCompares resolved base styles across coordinates without a stored cell on either side, including worksheet defaults and virtual style overlays; equivalent rectangle subdivisions compare equally, and equal adjacent changes coalesce into rectangles without materialising cells
lcoRichTextRunsCompares effective run fonts and text at matching stored text cells, inherits the base font for omitted run properties, disregards empty runs, and coalesces adjacent runs with equal effective fonts; plain text matches an equivalent default-font rich-text run
lcoPivotTablesPairs typed PivotTable definitions by name and compares source bindings, layout, fields, ordered view members, data aggregations, filters, grouping references, calculated definitions, styles, and native materialisation flags; cache and shared-member IDs resolve to source identities and typed values
lcoPivotCachesPairs local typed PivotCache definitions by source identity and compares refresh metadata, field metadata, grouped labels and ranges, unordered shared-member domains, and ordered typed record values; numeric, text, Boolean, date, error, and empty members stay distinct, dates retain binary64 precision, and cache IDs and shared-member slot order never create differences
lcoSlicerStatePairs named slicer views and caches, including table-column or non-OLAP Pivot bindings, connected PivotTable names, typed member selections, cross-filter and sort settings, caption, scroll position, column layout, dimensions, style, lock and caption flags, and anchor geometry; the bindings resolve table, column, sheet, and cache IDs
lcoTimelineStatePairs named typed timeline views and local non-OLAP caches, including source-field and connected PivotTable bindings, active date selection, caption, level, and worksheet bounds; inactive selections leave out unused date endpoints

Options has type TlxCompareOptions, a set of TlxCompareOption; enabling an option adds its differences to the default comparison

SetFeatureLimits(MaxBytes, MaxItems) validates both positive limits before changing either setting; MaxFeatureBytes defaults to 64 MiB and MaxFeatureItems defaults to 1,000,000, and the individual setters keep the same atomic validation

Feature budgets cover the aggregate detached canonical bytes and counted entries from both workbooks, including rich-text runs, filter XML nodes, Pivot fields, domain members and record values, and slicer or timeline connections; readers check counts and large text inputs before building native XML, enforce bounded output streams, and raise EXLSXSemanticBudget when a limit is exceeded

SetNumericTolerance(AbsoluteTolerance, RelativeTolerance) validates both arguments before changing either setting; both must be finite and nonnegative, and the separate AbsoluteTolerance and RelativeTolerance setters apply the same validation

Numeric literal and numeric cache values compare equally when their absolute difference is within AbsoluteTolerance or their difference relative to the larger absolute value is at most RelativeTolerance; a threshold of zero keeps exact equality, the relative calculation avoids overflow for extreme opposite values, and tolerance never coerces text or applies to dates, styles, or geometry

LeftName and RightName set optional display names used by Report lines, defaulting to left and right; the names affect reporting only, not sheet pairing or comparison

Comparer := TXLSXWorkbookCompare.Create;
try
  Comparer.Options := [lcoFormulaCachedResults, lcoCellStyles,
    lcoAxisGeometry];
  Comparer.SetNumericTolerance(0.001, 0.000001);
  DifferenceCount := Comparer.Compare(LeftWorkbook, RightWorkbook);
  for I := 0 to DifferenceCount - 1 do
  begin
    Entry := Comparer.Diff(I);
    ReportLines.Add(Entry.Describe);
  end;
finally
  Comparer.Free;
end;

Compare returns the difference count, Count reads that count afterward, and Diff(Index) uses zero-based indexing to return a comparer-owned TlxCompareDiff; retain the comparer whilst reading its entries, and reacquire entries after another successful comparison

Each entry provides Kind, Sheet, one-based Row and Col where applicable, Ref, LeftText, RightText, and typed LeftKind / RightKind values; TlxCompareValueKind contains lcvNone, lcvBlank, lcvNumber, lcvText, lcvBoolean, lcvDateTime, lcvError, and lcvFormula, with lcvNone used for an absent side or a non-value difference

TlxCompareKind retains lckSheetAdded, lckSheetRemoved, lckCellAdded, lckCellRemoved, lckValueChanged, lckFormulaChanged, lckMergeAdded, and lckMergeRemoved, and adds lckFormulaCacheChanged, lckStyleChanged, lckRowGeometryChanged, and lckColumnGeometryChanged

Style differences carry stable canonical style fingerprints in LeftText and RightText; geometry differences hold the compared size, hidden, outline, and collapsed state, with Ref naming the affected contiguous axis interval, Row set to its first row and Col to zero for rows, or Col set to its first column and Row to zero for columns

Feature differences use lckDefinedNameChanged, lckDataValidationChanged, lckConditionalFormatChanged, lckTableChanged, lckDrawingChanged, lckPivotTableChanged, lckPivotCacheChanged, lckSlicerChanged, or lckTimelineChanged; Change is lccChanged, lccAdded, or lccRemoved, and each present side carries its canonical definition fingerprint whilst an absent side carries an empty string

lckRichTextChanged identifies a changed run definition at its cell coordinate and takes canonical run fingerprints in LeftText and RightText; numeric tolerance applies to cell literals and formula caches, whilst typed feature definitions compare exactly

Feature references identify scoped names or table names, or use one-based sequence positions for validation, conditional-format, and drawing definitions; inserting or moving an ordered feature can change several positions, whilst workbook-level name entries have an empty Sheet

lckBlankStyleRegionChanged identifies a changed blank rectangle through Row, Col, inclusive LastRow and LastCol, and its A1 Ref; stored coordinates are covered by ordinary cell comparison and lcoCellStyles, so switch on both style options to inspect stored cells and blank areas together

Describe formats one entry, whilst Report(List) appends the formatted entries to a caller-owned TStrings; a typed value change includes type labels when the types differ, and results are sorted by sheet name, row, column, difference kind, and reference rather than cell insertion order

Comparison holds read leases, walks stored cells through detached cursor snapshots, and retains packed storage; geometry partitions stored metadata boundaries and compact repeated-row spans, whilst blank-style comparison sweeps active rectangle and stored-cell boundaries without scanning a rectangular million-row grid; work grows with stored features, region intersections, and reported differences

A failed comparison preserves the previous successful result; invalid tolerance assignment also preserves the existing settings and result, whilst passing a nil workbook clears the result and returns zero

This comparison covers the XLSX facade's stored cell content and selected typed feature definitions; name, validation, conditional-format, table, and chart formula spelling normalises through the semantic formula parser, whilst Pivot calculated formulas retain their stored definition text

Table filters accept supported custom, value-list, date-group, colour, icon, dynamic, and top-count shapes and sort conditions; independent filter columns and value-set entries normalise their order, Boolean defaults and numeric spellings normalise, and sort-condition order remains significant

Typed Pivot, slicer, and timeline comparison resolves supported local worksheet sources and non-OLAP bindings without refreshing or evaluating availability; native slicer availability hints are derived display metadata, whilst member selections and recognised native sort metadata are compared

Opaque native drawing properties, incomplete binary Pivot models, external or OLAP Pivot sources, raw PivotTable supplemental records and extension XML, unknown filter XML, and unmodelled slicer or timeline extension attributes or children raise EXLSSemanticSnapshot; preservation of such data does not imply semantic equivalence

Selected imported PivotTable and PivotCache features also validate preserved native XML before comparing the typed projection, including nested field metadata and cache records; unknown namespaces, attributes, children, and extension payloads fail explicitly within the same cooperative feature limits, whilst modelled slicer cache bindings remain supported

TSimpleDomNode.RawName exposes the original element QName alongside the reader-normalised Name, permitting namespace-sensitive inspection without changing existing parser name matching

Workbook settings and opaque package metadata remain outside comparison; base style comparison does not evaluate conditional-format or table-style appearance, and drawing comparison keeps the semantic snapshot's supported image, text-box, chart, and ordered-group boundaries

Effective rich-text properties

TMsoFbtOpt.StoredPids returns stored OfficeArt property identifiers in sorted order, whilst TMsoFbtSp.PersistentFlags exposes native shape flags without allocating properties or anchors

TMsoShapeContainer.HasPreservedObjectData identifies retained OBJ tail bytes; HasOrdinaryEmbeddedPictureObjectData checks that picture tails contain only recognised clipboard-format and zero picture-flag records, and rejects linked or unknown records without copying the payload

TMSOShapeTextBox.HasValidTextRuns checks stored TXO run boundaries and reserved fields without creating runs; TMsoDrawing.HasUnmodeledAppearance identifies native drawing data skipped by the typed parser, letting capture reject unresolved appearance explicitly

TXLSXRichTextRun.BoldSet, ItalicSet, StrikethroughSet, UnderlineSet, VertAlignSet and ColorSet distinguish inherited font properties from explicit overrides, including false flags, none, baseline and automatic colours; setters mark the property explicit even when its value equals the new run's initial default

TXLSXRichText.HasUnsupportedAppearance reports native rich properties that the typed run model cannot represent; portable capture and effective rich-text comparison reject such runs explicitly, whilst supported shared/inline run properties and whitespace retain their imported semantics

Effective rich-text comparison applies explicit false overrides before coalescing adjacent equal runs; inherited and explicitly cleared properties stay distinct during shared-string deduplication and supported XML roundtrips

TXMLReader.ResolveNamespaceUri(Prefix, Uri) resolves the current in-scope namespace binding without altering reader position, returning false when no binding exists; an empty prefix requests the default namespace, and raw QNames stay available for namespace-sensitive inspection

The immutable rich/scene records, capture-source extension and HXRSNP02 transfer contract are described in Portable headless output

Detached style and axis inspection

TXLSXWorksheet.ReadSemanticCellStyle(Row, Col) returns a detached TXLSSemanticCellStyle for valid one-based coordinates, resolving stored and packed styles, worksheet defaults, applicable style overlays, implicit date formats, indexed colours, and theme colours without materialising cells or changing style pools; the public call acquires a read lease and excludes conditional-format and table-style rules

TXLSXWorksheet.GetStoredAxisSpans(IsRow) returns TXLSXAxisSpans, an array of TXLSXAxisSpan records with inclusive one-based FirstIndex and LastIndex; it reports size, hidden, outline, and collapsed metadata footprints, keeps compact repeated-row height spans, and leaves the worksheet's effective default reachable through its ordinary properties

The returned spans describe stored metadata footprints rather than a disjoint normalised partition; applications comparing two axes can combine their first and last boundaries, then inspect the effective state once per resulting interval

TXLSXWorksheet.GetStoredStyleRegions returns detached TXLSXStyleRegions containing inclusive FirstRow, FirstCol, LastRow, and LastCol boundaries for compact virtual-formatting footprints; such footprints can overlap, and callers read their effective appearance with ReadSemanticCellStyle

TXLSXWorkbook.ReadSemanticFeatures(Kind, Sheet, MaxBytes, MaxItems) returns detached TXLSXSemanticFeatures entries with a stable Key, canonical Definition bytes, and counted ItemCount; optional positive limits default to 64 MiB and 1,000,000 entries

TXLSXSemanticFeatureKind contains xlsxSemanticDefinedNames, xlsxSemanticDataValidations, xlsxSemanticConditionalFormats, xlsxSemanticTables, xlsxSemanticDrawings, xlsxSemanticPivotTables, xlsxSemanticPivotCaches, xlsxSemanticSlicers, xlsxSemanticSlicerCaches, xlsxSemanticTimelines, and xlsxSemanticTimelineCaches

Defined names and the three cache kinds use workbook-wide scope and permit a nil sheet; the other kinds require a worksheet belonging to the workbook, rules and drawings retain their stored sequence, and returned arrays and buffers are caller-owned copies; these readers acquire read leases and inherit the typed coverage and explicit unsupported-data behaviour described above

TXLSXWorksheet.ReadSemanticRichText(Row, Col, IncludePlainText, MaxBytes, MaxItems, ConsumedItems) returns detached canonical run bytes for one-based coordinates, or an empty buffer when no rich text is present and IncludePlainText is false; optional ConsumedItems: PInteger receives the captured run count, and plain-text capture retains packed storage

TXLSPivotCacheField.GroupItemTypes[Index] exposes the typed kind corresponding to GroupItemLabels[Index] and rejects an index outside the stored grouped-label domain

Formula metadata and Pivot query callbacks

TXLSGetCellFormulaText and TXLSCalculator.OnGetCellFormulaText read stored expression text using a one-based SheetIndex and zero-based Row/Col, returning lxOk or a typed error code and honouring formula-hidden protection; TXLSGetPivotTable and OnGetPivotTable locate a borrowed table through one-based SheetIndex and zero-based range coordinates

The workbook engines wire these optional callbacks in normal, read-only and isolated calculation contexts; callbacks never recalculate targets, refresh Pivot sources or take over ownership

TXLSPivotDataConstraint stores a FieldName and typed Item, with TXLSPivotDataConstraints collecting field/item pairs; TXLSPivotTable.GetDataValue queries one visible supported aggregate from a detached local table or cache snapshot and IntersectsQueryRange uses one-based worksheet bounds including modelled report-filter cells

TlxPivotQueryBudget receives work and memory estimates synchronously and reports whether evaluation can continue; EXLSPivotQueryBudget and EXLSPivotQueryUnsupported distinguish exhausted limits from unsupported cache or aggregate models

TXLSPivotCache.QueryModelIsComplete records decoded query readiness separately from BIFF raw replay completeness; QueryRecordsValid exposes imported record validity and SetQueryRecordValidity applies format-reader precedence without refreshing records

Explicit code-page bytes

MemberContract
XlsEncodeCodePage(Text, CodePage, MaxBytes = -1)Returns RawByteString with exact bytes in an explicit nonzero byte-oriented page, keeps embedded nulls, verifies Unicode round-trip identity, and raises EConvertError for unrepresentable text; a nonnegative MaxBytes keeps the longest complete-character prefix that fits, whilst -1 leaves length unbounded; validation covers the original text before truncation
XlsDecodeCodePage(Bytes, CodePage)Returns WideString from the explicit byte encoding and preserves embedded nulls; malformed byte sequences follow the installed decoder behaviour; page 0 and UTF-16 page 1200 are rejected because this API does not infer an ANSI locale or handle a UTF-16 byte stream
TXLSBlob.GetCompressedUnicodeString(Index, Count)Returns exact BIFF8 compressed Unicode U+0000 through U+00FF code units, preserves embedded nulls, validates the requested byte range, and never interprets those bytes using a code page
TXLSBlob.AddRawStringAppends exact encoded bytes without an AnsiString code-page conversion and updates DataLength; an empty input appends no bytes
TXLSCalculator.CodePage, TXLSFormula.FCodePageSelect the explicit legacy formula byte encoding, defaulting to CP1252; the owning Classic workbook synchronises its calculator when initialised or when SetCodePage is called
TXLSFontList.GetFont, TXLSNumFormatList.GetNumFormatBlob, TXLSStyles.GetStyleBlobThe optional CodePage argument defaults to 1252 and encodes BIFF5 text; BIFF8 output remains Unicode
TMsoDrawing.StoreNotesThe optional CodePage argument defaults to 1252 and encodes pre-Unicode comment text; the existing BIFF5 ordinary-comment record size limit still applies; no author, rich-text or geometry fields absent from that record format are added
TXLSCustomName.SetSourceDataThe optional FileFormat and CodePage arguments identify imported raw NAME bytes and default to xlExcel97 and 1252; raw records are only reused when their format and legacy encoding match the requested output
TXLSFormulatArrayItem.GetDataSize, TXLSFormulatArray.GetDataSize, TXLSFormulatArray.GetData, TXLSFormulatArrays.GetDataSize, TXLSFormulatArrays.GetData, TXLSCompiledFormula.GetExternalDataThe optional ACodePage argument defaults to 1252; legacy string-array size and output use the same encoded-byte count, whilst BIFF8 strings remain Unicode

Pass the returned RawByteString directly to AddRawString or a byte-oriented stream operation; converting it to a default AnsiString can recode its bytes on native FPC systems

Classic defined names and array-formula blocks

TXLSCustomName deferred compilationClearDefinition frees the compiled RefersTo AST whilst keeping the stored definition string and any raw imported NAME bytes, Compile rebuilds the AST from the stored definition and reports success, and GetCompiledFormula re-compiles automatically, so a cleared name re-resolves on its next read; PeekCompiledFormula returns the current AST without triggering that re-compile, and StoredDefinition exposes the unparsed definition source
TXLSCustomName identity and flagsStoreIndex exposes the name's storage position within its collection, NameID its workbook-unique numeric identity as used by the calculation engine, and IsHidden and IsMacro read and write the hidden and macro flags of the BIFF NAME record
TXLSFormulatArray.RowsCount, ColsCountReport the row and column extents of the parsed array-formula block; both start at one and bound the per-cell item domain that the emission methods carry

Classic font, format, and style pools

TXLSFontList stored font attributesIndexed properties mirror the stored font key at a zero-based list index: Name, Size, ColorIndex, Bold, Italic, Strikethrough, and Underline join OutLineFont, Shadow, SubScript, SuperScript, Family, and CharSet for read-only inspection
TXLSNumFormatList.AddValue, FmtExistsAddValue registers a format string and returns its index, mapping built-in format spellings onto canonical ids and flagging date and time formats; FmtExists reports whether a custom format string is registered already
TXLSNumFormatList.IsDateFormat, IsDateFormatValueIsDateFormat reports whether the format stored at an index is flagged as a date or time format, whilst IsDateFormatValue tests a format string directly for date and time tokens
TXLSStyles.AddStyle, AddBuiltinStyleAddStyle registers a named custom cell style bound to an XF record index, and AddBuiltinStyle registers a built-in cell style by its built-in id together with the outline level that row and column level styles use
TXLSStyles.BuiltinStyleNameClass function returning the canonical Excel built-in cell-style display name for built-in ids 0 through 53; out-of-range ids return an empty name so writers fall back on the raw builtin-byte form

Package and binary storage helpers

TXLSXOpaquePackageLoadWorkbookXmlMetadata captures workbook-level XML state, MarkAllPartsClean resets dirty flags, and WorkbookExtLstXml plus WorkbookRootAttributesXml expose preserved workbook XML fragments; IsDiscardedPart reports whether a part name was removed by a discard operation such as web add-in cleanup
TXLSFileStorageLoad, LoadFolder, Write, and WriteFolder transfer compound-file content; Child and Count enumerate child entries, each a TXLSFileItem — a named storage node whose TXLSFileStream subclass carries the stored bytes as a TXLSBlob with DataSize reporting the payload length
TXLSBlobAdd appends another blob, while AddByte, AddWord, AddLong, AddDouble, AddString, and AddWideString append typed values; CopyData, CopyMem, FillByte, Write, Clear, Reset, and Dump manage content; Buff and DataLength expose storage
TXLSBlobListAppend, AppendList, CopyData, and Write combine or emit entries; Entries and TotalSize expose list state
TXLSWideStringBuilderAddString appends text and Length reports the accumulated character count

Drawing and workbook viewer additions

TXLSFillFormatPictureFill configures a picture-backed shape fill, whilst FillType selects the fill kind (solid, gradient, picture, or preset texture) that the writer will emit
TXLSShapesAddScrollBar and AddSpinner create form controls — the returned TXLSScrollBar and TXLSSpinner objects expose the control geometry and linked cell, and the spinner adds Min, Max, and Inc step limits — whilst RegisterScrollBar and RegisterSpinner register controls loaded from a workbook
TXLSWorkbookViewerCanUndo and CanRedo report transaction history availability; ClearSelectedRange, CopySelectedRange, PasteSelectedRange, and PasteText operate on the selected range, whilst ReferencePickMode enables interactive cell or range reference selection
TXLSWorkbookEditHistoryThe headless content transaction engine in lxWorkbookViewer binds a borrowed classic or XLSX workbook and offers range protection preflight, Unicode text copy and paste, range clear, and one undo/redo transaction per operation; see headless editing transactions
TXLSCellContentSnapshotBoth worksheet classes expose ReadCellContent(Row, Col) and RestoreCellContent(Snapshot) for detached native content capture and restoration at one-based coordinates in the originating worksheet; capture does not evaluate formulas, create absent cells, or materialise packed storage, and the immutable NativeData payload preserves rich text, formula caches, and cell style; direct restoration is a low-level operation whose caller must check protection and structural boundaries

Pagination, image output, and printing

XLSValidateCachedChartSceneModel, XLSRecordCachedChartScenePreflights cached chart metadata without resolving cells and records bounded vector and text primitives for a detached chart within lxPortableChart, returning TXLSPortableSceneObjects and item, byte, and text accounting; the lxPagination entry points keep the same shared implementation for existing Windows callers; the current subset covers ordinary column, bar, line, scatter, pie, doughnut, and single-series area charts with one primary plot group, and recording requires validated native metadata, finite strictly ordered cache points, and an unattached chart model; see cached chart recording
TXLSGraphicsBackendDrawTiledImage paints a sheet background repeatedly across the clipped page region
TXLSPaginationModelCompactRangeMode, IncludeDrawings, IncludeGridlines, IncludeCellBorders, and PaintPageBackground control page content; RenderDPI, RenderColorMode, and RenderSession expose output resolution, colour handling, and the active render session
TXLSCellImageExporterMeasure calculates pixel dimensions for classic or XLSX ranges; ImageFormat, JpegQuality, MaxPixels, MaxBytes, IncludeObjects, IncludeGridlines, IncludeCellBorders, BackgroundColor, TransparentBackground, BeforePaint, AfterPaint, and PaginationModel configure and observe the render
TXLSPageImageExporterBeforePaint, AfterPaint, MaxPixels, MaxBytes, BackgroundColor, and TransparentBackground apply the same paint hooks and output safety limits to paged image export
TXLSPrintDocumentPrintWorksheet, PrintWorkbook, and PrintAllVisibleSheets send classic or XLSX content to the VCL printer; FirstPage, PrintRangeOnly, Collate, Copies, OnBeforeNewPage, and OnAfterGeneratePage control the print job

Classic chart models and worksheet chart objects

TXLSXChartSeriesLineVisible, LineColorRGB, and LineWidthPoints describe an independent series stroke; LineStyleSet, LineColorSet, and LineWidthSet preserve explicit settings, and EffectiveLineVisible resolves the legacy fill-only convention; MarkerFillSet and MarkerBorderSet distinguish explicit black from automatic marker colours, whilst line and scatter portable recording supports circle diameters from 2 through 72 points; colour and width setters validate before mutation and obey workbook read leases
TXLSChartSeriesAddTrendline and AddErrorBars create typed series annotations, whilst TrendlineCount and ErrorBarCount report their collection sizes; the existing MarkerSize field retains raw BIFF twips, whilst the read-only MarkerSizePoints getter returns that value divided by 20, including fractional point sizes
TXLSChartAxisHasAxcExtFlag tests one raw AXCEXT flag without requiring callers to decode the bit mask
TXLSChartModelAxisGroupCount reports the number of primary and secondary axis groups decoded from the chart
TXLSCustomChartAddAreaData appends a pre-built area item for save-time formula rebinding and ApplyDateAxisModel applies a typed date-axis model to the raw chart records; GetStoredRecordInfo reads a zero-based record ID and byte count without allocation, whilst ReadStoredRecord(Index, MaxBytes) checks the byte limit before returning detached bytes in TXLSChartStoredRecord, without evaluating formulas or modifying caches
TXLSWorksheetAddChartObject anchors a chart frame on the worksheet and hooks it up to the shared chart builder
TXLSXChartLayoutResolverTryResolve resolves one layout rectangle with optional size validation and ResolveChart calculates chart, title, legend, plot, and axis rectangles

Typed chart decode model

The decoded chart state is exposed as plain records and enums so inspection code never needs to walk raw BIFF records: TXLSChartInfo carries the decoded chart summary with TXLSChartTypeFamily (cfBar, cfLine, cfPie, cfArea, cfScatter, cfRadar, cfDoughnut, cfSurface, cfBubble), each series reports TXLSChartSeriesType, and TXLSChart3DState plus TXLSChart3DInfo describe three-dimensional views. TXLSChartAxisType (catCategory, catValue, catSeries, catDate) and TXLSChartLegendPosition classify axes and legends, whilst the date-axis model uses TXLSChartDateUnit (xcduDays, xcduMonths, xcduYears) and TXLSChartDateValues. TXLSCustomChart exposes the decoded model through TXLSChartInfo; trendline and error-bar annotations are typed objects (TXLSChartTrendline, TXLSChartErrorBars) reachable from each series

Chart authoring records

Chart-sheet and builder authoring takes plain records instead of object graphs: TXLSChartTrendlineInfo, TXLSChartErrorBarsInfo, TXLSChartDataLabelsInfo, and TXLSChartSeriesStyleInfo fill the series entries passed to TXLSWorksheets.AddChartSheet and the shared chart builder, and TXLSPivotChartInfo describes the pivot-chart framing applied when a chart is attached to a pivot table

Classic chart fill inspection

TXLSCustomChart.GetChartModel decodes supported native OfficeArt property tables plus tertiary property tables in GelFrame records, including properties following complex payload entries; the existing builder representation stays supported, and malformed table bounds leave the prior typed fill unchanged and report the unsupported record

Chart inspection validates the complete stored text and annotation payload before adding typed state: truncated trendline names or data-label separators report their record ID via _UnsupportedSemanticRecordID, whilst nil or undersized SeriesText headers report that record as unsupported under both BIFF5 and BIFF8; a declared series-text extent that exceeds its payload raises EReadError, frees the partial model and leaves the stored chart records unchanged

The marker getter and fill inspection preserve raw chart storage; the declared appearance capture path separately validates supported core charts, whilst unverified rich title or shape extension checksums remain unsupported

Bounded stored chart, string and font readers

TXLSChartStoredBytes is a detached byte array and TXLSChartStoredRecord contains RecordId and Data; these readers inspect retained source storage without building a decoded chart model or evaluating formulas

TXLSCustomChart.GetStoredRecordInfoReturns a record ID and counted byte length for a zero-based record index without duplicating its payload
TXLSCustomChart.ReadStoredRecordCopies one payload after validating the index and nonnegative MaxBytes; the default byte limit is High(Int64)
TXLSCustomChart.ReadStoredFormulaLeafInfoInspects a coherent stored BRAI leaf using the exact source calculator and nonnegative byte and text quotas; foreign calculators or translation owners yield an unsupported leaf, and AllowUnboundBiff defaults to False
TXLSCustomChart.ReadStoredFormulaLiteralSupplies a detached literal only once the same provenance and quota checks pass; an unsupported leaf raises EInvalidOperation
TXLSCustomChart.SourceBiffVersion, SourceCodePageRead-only provenance of the retained chart records
TXLSStringTable.GetStoredStringLength, ReadStoredStringCounts existing UTF-16 storage using the table's one-based string identity, then copies only when the nonnegative character quota covers it; invalid identities and incomplete UTF-16 storage are rejected
TXLSFontList.GetStoredNameLength, ReadStoredNameChecks the stored font key at the list's zero-based index before counting or copying its name within a nonnegative character quota
TMsoFbtOptItem.HasStoredUnicodeStringChecks bounded stored complex Unicode-string metadata without materialising a string
TMsoShapeContainer.HasOrdinaryChartObjectDataChecks stored chart object type, nonzero object identity, supported flags and the absence of unknown object-tail data

Shared string table maintenance and SST emission

TXLSStringTable in lxStringTable underpins the classic workbook's shared strings; the members below cover reader-side registration, slot maintenance, and raw SST emission for round-trip saves

KeyExists, AddWithExtrasKeyExists reports whether a string already occupies a slot; AddWithExtras is the reader-side companion to Add that attaches the raw rgRun rich-text and rgExtRst phonetic payload to the entry without raising its reference count, since each referencing cell later restores the count through the normal add path
Replace, ReplaceIndexReplace removes one reference at the old slot, freeing it when its count reaches zero, and re-adds the text, returning the resulting slot; ReplaceIndex moves one reference from the old slot to the new slot without duplicating text
AddSSTData, InitExtIndexAddSSTData emits the raw SST payload into the writer's blob list; the overload taking a font-run remap table rewrites each FormatRun font index on the way out ([MS-XLS] §2.5.129) so rich runs follow save-time font reordering, whilst an empty table keeps legacy verbatim emission, and InitExtIndex numbers the ExtSST buckets over live slots before emission
SlotCount, ExtIndex, ParsedExtSSTDsst, ParsedExtSSTItemCount, BiffSizeLimitSlotCount is the one-based upper bound for slot iteration where deleted slots read as empty, ExtIndex resolves a slot to its ExtSST bucket number or -1 for a slot that is not live, ParsedExtSSTDsst and ParsedExtSSTItemCount retain imported EXT/SST header values, and BiffSizeLimit bounds each emitted record chunk — the classic writer fixes it at 2080 bytes for BIFF5 and 8224 for BIFF8

PDF attachments, signatures, and HTML export

IXLSPDFAttachmentSourceWriteTo streams attachment bytes into the PDF export without the exporter having to own the source data
TXLSPDFExportAttachmentDuplicatePolicy selects duplicate-name handling, AttachmentSpoolThreshold controls attachment spooling, and DocumentLanguage writes the document language metadata
TXLSPDFSignatureTextAlign, TextSize, TextColor, TextBold, and TextItalic configure the visible signature appearance
TXLSHTMLExportViewMode (type TXLSHtmlViewMode: current view or full spreadsheet table) chooses the HTML presentation, whilst HotTrackTargets (set of TXLSHtmlHotTrackTarget) and HotTrackColor configure interactive cell and object highlighting
TXLSXHtmlExportOptionsViewMode, HotTrackTargets, and HotTrackColor provide the equivalent XLSX HTML export controls

Calculation audit and workbook controls

TXLSCalculationAuditReportTruncated reports an issue-limit truncation, StackTruncated reports call-stack frame truncation, and Issues indexes the recorded calculation issues
TXLSUserFunctionRegistryGeneration changes whenever the registered user-function set changes, so cached formula bindings can be invalidated
EXLSReportRecoverableDataCategory identifies the recoverable report-data category presented to the caller
IXLSWorkBookManualCalculationThreadCount limits the worker count used by manual calculation
TXLSXDataValidationHasUnknownImeMode reports an IME mode value that HotXLS preserved but does not recognise
TXLSXTableColumnCalculatedFormulaArrayRaw and ColumnTotalsFormulaArrayRaw expose the original array-formula text for table columns

Legacy PivotCache framing compatibility

TXLSPivotCacheRawBucketIndex identifies the source substream position, RawFramingIsLegacy identifies an old HotXLS framing, RawModelIsComplete reports whether the typed model represents every record, and CanUpgradeFraming reports whether opt-in typed re-emission is safe
TXLSPivotCacheStreamId exposes the classic cache stream identity, SourceDataType exposes the classic source-data type, and RawHasStorageStream reports whether a loaded cache arrived from an independent PivotCache storage stream
TXLSWorkbookUpgradeLegacyPivotCacheFraming opts in to rewriting only legacy HotXLS cache framings whose typed model is complete; ordinary raw cache replay stays the default

StreamId is written as the SXStreamID record ([MS-XLS] §2.4.303) and repeated as the SXDB header idstm field, which must equal it; SourceDataType is written as the SXVS record ([MS-XLS] §2.4.317: $0001 worksheet, $0002 external, $0004 consolidation, $0010 scenario) and repeated as the SXDB header vsType field, which must equal it. Caches built from a worksheet range start at the worksheet type, whilst caches read back from a file keep the value their substream carried, so the BIFF writer never leaves an SXDB field naming a record it did not emit; RawHasStorageStream marks a cache loaded from its own storage stream whose workbook-global descriptor comes before the cached records

Clipboard integration and paste options

TXLSPasteOption = (xlpoValuesOnly, xlpoInsertRows, xlpoInsertCols);
TXLSPasteOptions = set of TXLSPasteOption;

function XLSGetClipboardText: WideString;
function XLSSetClipboardText(const Text: WideString): Boolean;
function XLSSetClipboardTextAndHtml(const Text: WideString;
  const Html: AnsiString): Boolean;
function XLSBuildHtmlClipboard(const Html: AnsiString): AnsiString;
function XLSEncodeClipboardField(const Text: WideString): WideString;
function XLSClipboardHasText: Boolean;
function XLSParseClipboardGrid(const ClipboardText: WideString;
  Loader: TXLSCSVLoader): Boolean;
function XLSClipboardHasXmlSpreadsheet: Boolean;
function XLSGetClipboardXmlSpreadsheet: WideString;
function XLSParseXmlSpreadsheet(const XmlText: WideString;
  Loader: TXLSCSVLoader): Boolean;
function XLSClipboardHasBiff8: Boolean;
function XLSGetClipboardBiff8: AnsiString;
function XLSReadClipboardPasteData(out Biff8: AnsiString;
  out Text: WideString): Boolean;
function XLSSetClipboardBiff8(const Biff8: AnsiString;
  const Text: WideString; const Html: AnsiString = ''): Boolean;
      
The paste options are shared by both facades' PasteFromClipboard overloads: xlpoValuesOnly keeps the cached values of formula cells and skips formats and merges, whilst xlpoInsertRows and xlpoInsertCols shift existing content before the block lands
The helpers wrap the Windows clipboard for spreadsheet interop: the text helpers use CF_UNICODETEXT (falling back to CF_TEXT through the current ANSI code page), XLSSetClipboardTextAndHtml writes text and a styled HTML Format payload in one transaction, XLSBuildHtmlClipboard computes the CF_HTML byte offsets for a document or fragment, and XLSEncodeClipboardField quotes one tab-separated field. XLSParseClipboardGrid parses clipboard text as tab-separated rows with the same type sniffing TXLSCSVLoader uses for CSV, XLSParseXmlSpreadsheet runs the same loader fill over a SpreadsheetML 2003 payload fetched with XLSGetClipboardXmlSpreadsheet, and the Biff8 helpers detect and read the native stream Excel itself places on the clipboard so pasted data keeps its values, formulas, and formatting without text loss
XLSReadClipboardPasteData captures the Biff8 stream and the Unicode text in a single clipboard lock, so a paste never has to re-open the clipboard between the two reads and loses neither format to a concurrent writer. XLSSetClipboardBiff8 is the matching write side: it puts the BIFF8 compound-file stream, tab-delimited Unicode text, and an optional CF_HTML payload in one transaction — pass an empty Text or Html to skip either companion format, whilst the Biff8 part is required

Cell display text resolution

TXLSCellDisplayMode = (xcdmFormattedValue, xcdmFormulaText,
  xcdmSuppressedZero);

TXLSCellDisplayOptions = record
  ShowFormulas: Boolean;
  ShowZeros: Boolean;
  SheetProtected: Boolean;
  FormulaWidthFactor: Double;
  DateSerialZero: Double;
end;

TXLSCellDisplayInput = record
  HasFormula: Boolean;
  FormulaHidden: Boolean;
  IsNumericZero: Boolean;
  FormulaText: WideString;
  FormattedText: WideString;
end;

TXLSCellDisplayResult = record
  Mode: TXLSCellDisplayMode;
  Text: WideString;
  TreatAsText: Boolean;
  EffectiveWidthFactor: Double;
end;

function XLSDefaultCellDisplayOptions: TXLSCellDisplayOptions;
function XLSNormalizeFormulaDisplayText(const FormulaText: WideString): WideString;
function XLSResolveCellDisplay(const Options: TXLSCellDisplayOptions;
  const Input: TXLSCellDisplayInput): TXLSCellDisplayResult;
      
One shared resolver decides what a cell shows for a given view state: formulas in place of values, suppressed zeros, hidden formula text on protected sheets, and the doubled width factor Excel applies to formula display. The workbook viewer and the renderers call it via their display-options entry points, and applications can call XLSResolveCellDisplay directly with their own input records; XLSDefaultCellDisplayOptions returns the canonical defaults and XLSNormalizeFormulaDisplayText normalises a formula string for display

Classic data validation objects

TXLSDataValidationType = (xlsDvAny, xlsDvWhole, xlsDvDecimal, xlsDvList,
  xlsDvDate, xlsDvTime, xlsDvTextLength, xlsDvCustom);
TXLSDvErrorStyle = (xlsDvErrStop, xlsDvErrWarning, xlsDvErrInformation);

TDVRange = class;             { one validation rule over one or more ranges }
TDVRangeList = class;         { the per-sheet rule collection }
TDataValidator = class;       { engine that checks edits against the rules }
      
The typed TXLSWorksheet.Add*Validation helpers create TDVRange rules in the sheet's TDVRangeList; each rule carries its TXLSDataValidationType, bounds, input and error messages, and TXLSDvErrorStyle. TDataValidator evaluates an edit against the rules and reports whether the value is acceptable, which is also the check that stands behind Excel's own validation prompts

Indexed colour scanning and resolution

TXLSIndexedColorKind = (xickPalette, xickAutomatic, xickSystem, xickInvalid);
TXLSSystemColorRole = (xscrNone, xscrWindowText, xscrWindowBackground,
  xscrChartText, xscrChartBackground, xscrChartNeutral, xscrToolTipText);

TXLSIndexedColorResolution = record
  Kind: TXLSIndexedColorKind;
  RawIndex: Int64;
  PaletteSlot: Integer;
  SystemColorRole: TXLSSystemColorRole;
  ARGB: LongWord;
  HasResolvedColor: Boolean;
end;

TXLSNearestIndexedColorMatch = record
  InputARGB: LongWord;
  ColorIndex: Integer;
  PaletteSlot: Integer;
  ARGB: LongWord;
  DistanceSquared: Double;
  ExactMatch: Boolean;
end;

TXLSIndexedColorUsageKind = (xicukFont, xicukFillForeground,
  xicukFillBackground, xicukGradient, xicukBorder, xicukConditionalFormat,
  xicukChart, xicukShape, xicukComment, xicukWorksheet, xicukOther);
      
These records back the workbook-level ResolveIndexedColor, NearestIndexedColor, and ScanIndexedColorUsage methods: a resolution reports which of the four TXLSIndexedColorKind sources an indexed token came from together with its palette slot, system-colour role, and normalised ARGB, a nearest match adds the squared RGB distance and exact-match flag, and the usage scan tags every consumer category that locks a palette slot. The library keeps an internal TXLSIndexedColorMatcher cache keyed by palette generation — FindNearest answers nearest-colour queries from it and UpdateSlot patches one palette slot — so repeated resolutions stay allocation-free

A1 reference helpers

function XLSA1CellRef(ARow, ACol: Integer): WideString;
function XLSTryParseA1CellRef(const ARef: WideString;
  out ARow, ACol: Integer): Boolean;
function XLSTryParseA1RangeRef(const ARef: WideString;
  out ARow1, ACol1, ARow2, ACol2: Integer): Boolean;
      
Standalone helpers for the same A1 notation the workbook APIs accept: they format zero-based coordinates as an A1 cell reference and parse cell or range references back again, returning False for malformed input instead of raising

See also