HotXLS Docs

TXLSXWorkbook class

Top-level container for an Excel 2007+ (.xlsx) workbook. Declared in lxHandleX. Holds a TXLSXSheets collection and provides SaveAs / Open entry points for OOXML workbooks, CSV / TSV import, and OpenDocument spreadsheets (.ods) read/write workflows

Declaration

type
  TXLSXFileFormat = (xlsxOpenXMLWorkbook, xlsxOpenDocumentSpreadsheet,
    xlsxOpenXMLTemplate, xlsxOpenXMLMacroEnabledTemplate, xlsxExcelBinaryWorkbook);

  TODSExportOptions = class
    constructor Create;
    property Generator: WideString;
    property IncludeCharts: Boolean;
    property IncludeImages: Boolean;
  end;

  TXLSXWorkbook = class
    constructor Create;
    destructor Destroy; override;
    function CreateLoadedCellCursor: IXLSLoadedCellCursor; overload;
    function CreateLoadedCellCursor(AIncludeStoredBlanks: Boolean): IXLSLoadedCellCursor; overload;
    function CreateReadOnlyView: IXLSReadOnlyWorkbookView;
    property RenderCalibration: TXLSRenderCalibration;
    function CaptureRenderCalibration: TXLSRenderCalibration;
    procedure ResetRenderCalibration;
    function CreateRenderGeometry(ABackend: TXLSRenderGeometryBackend;
      ACacheCapacity: Integer = 4096): IXLSRenderGeometry;
    function SaveAs(const FileName: WideString): Integer; overload;
    function SaveAs(const FileName: WideString; FileFormat: TXLSXFileFormat): Integer; overload;
    function SaveAs(Stream: TStream): Integer; overload;
    function SaveAs(Stream: TStream; FileFormat: TXLSXFileFormat): Integer; overload;
    function GetConversionReport(ATarget: TXLSConversionTarget): TXLSConversionReport;
    function SaveAsChecked(Stream: TStream; FileFormat: TXLSXFileFormat;
      AllowLossy: Boolean = False): Integer; overload;
    function SaveAsChecked(const FileName: WideString; FileFormat: TXLSXFileFormat;
      AllowLossy: Boolean = False): Integer; overload;
    function Open(const FileName: WideString): Integer; overload;
    function Open(const FileName: WideString; const Password: WideString): Integer; overload;
    function Open(Stream: TStream): Integer; overload;
    function OpenCSV(const FileName: WideString): Integer; overload;
    function OpenCSV(const FileName: WideString; ASeparator: WideChar;
      ADetectTypes: Boolean): Integer; overload;
    function OpenCSV(Stream: TStream): Integer; overload;
    function OpenCSV(Stream: TStream; ASeparator: WideChar;
      ADetectTypes: Boolean): Integer; overload;
    function OpenODS(const FileName: WideString): Integer; overload;
    function OpenODS(Stream: TStream): Integer; overload;
    function SaveAsODS(const FileName: WideString): Integer; overload;
    function SaveAsODS(Stream: TStream): Integer; overload;
    function SaveAsODS(const FileName: WideString; Options: TODSExportOptions): Integer; overload;
    function SaveAsODS(Stream: TStream; Options: TODSExportOptions): Integer; overload;
    function GetODSSheetNames(const FileName: WideString; AList: TStrings): Integer; overload;
    function GetODSSheetNames(Stream: TStream; AList: TStrings): Integer; overload;
    function GetSheetNames(const FileName: WideString; AList: TStrings): Integer; overload;
    function GetSheetNames(Stream: TStream; AList: TStrings): Integer; overload;
    function SaveAsCSV(const FileName: WideString): Integer; overload;
    function SaveAsCSV(const FileName: WideString; SheetIndex: Integer; Delimiter: WideChar): Integer; overload;
    function SaveAsCSV(Stream: TStream): Integer; overload;
    function SaveAsCSV(Stream: TStream; SheetIndex: Integer; Delimiter: WideChar): Integer; overload;
    function SaveAsHTML(const FileName: WideString): Integer; overload;
    function SaveAsHTML(const FileName: WideString; Options: TXLSXHtmlExportOptions): Integer; overload;
    function SaveAsHTML(const FileName: WideString; SheetIndex: Integer): Integer; overload;
    function SaveAsHTML(const FileName: WideString; SheetIndex: Integer; Options: TXLSXHtmlExportOptions): Integer; overload;
    function SaveAsHTML(Stream: TStream): Integer; overload;
    function SaveAsHTML(Stream: TStream; Options: TXLSXHtmlExportOptions): Integer; overload;
    function SaveAsHTML(Stream: TStream; SheetIndex: Integer): Integer; overload;
    function SaveAsHTML(Stream: TStream; SheetIndex: Integer; Options: TXLSXHtmlExportOptions): Integer; overload;
    function SaveAsRTF(const FileName: WideString): Integer; overload;
    function SaveAsRTF(const FileName: WideString; SheetIndex: Integer): Integer; overload;
    function SaveAsRTF(Stream: TStream): Integer; overload;
    function SaveAsRTF(Stream: TStream; SheetIndex: Integer): Integer; overload;
    // AES encryption (ECMA-376 Standard Encryption) write path.
    // OpenEncrypted still raises for encrypted packages.
    function SaveAsEncrypted(const FileName, APassword: WideString): Integer;
    function OpenEncrypted(const FileName, APassword: WideString): Integer;
    function CanReadEncrypted(const FileName: WideString): Boolean;
    function Calculate(const Formula: WideString): Variant;
    function CalculateAndVerify: Integer; overload;
    function CalculateAndVerify(out AMismatches: TArray<TXLSVerifyMismatch>): Integer; overload;
    property OnUserFunction: TXLSUserFunctionEvent;
    property OnUserFunctionEx: TXLSUserFunctionExEvent;
    property AllowUnsafeFormulaCallbacks: Boolean;
    // Document properties (docProps/core.xml + docProps/app.xml).
    property Title, Author, Subject, Keywords, Description,
             Category, LastModifiedBy, Company,
             Application, AppVersion: WideString;
    property Created, Modified: TDateTime;
    // Workbook protection (16-bit legacy hash).
    procedure ProtectWorkbook; overload;
    procedure ProtectWorkbook(const APassword: WideString); overload;
    procedure ProtectWorkbook(const APassword: WideString; ALockStructure, ALockWindows: Boolean); overload;
    procedure UnProtectWorkbook;
    property IsWorkbookProtected: Boolean;
    property LockStructure, LockWindows: Boolean;
    // VBA project payload (round-trips byte-for-byte). Workbook is saved
    // with macro-enabled content type when HasVbaProject is True.
    procedure LoadVbaProjectFromFile(const AFileName: WideString);
    procedure ClearVbaProject;
    function HasVbaProject: Boolean;
    property VbaProjectDefined: Boolean;
    property VbaProject: AnsiString;
    property ParsedVBAProject: TXLSVBAProject;
    // Unknown package and workbook extension preservation
    procedure ClearUnsupportedParts;
    function UnsupportedPartCount: Integer;
    function UnsupportedPartBytes: Int64;
    property PreserveUnsupportedParts: Boolean;
    // Chart sheet helper — creates a sheet flagged IsChartSheet and
    // seeds Charts[0] with a default full-page anchor.
    function AddChartSheet(const AName: WideString;
      AChartType: TXLSXChartType; const ATitle: WideString): TXLSXWorksheet;
    // Streaming SaveAs path (TXLSWideStringBuilder + one sheet at a time).
    property StreamingWrite: Boolean;
    // Streaming parallel Open path
    property ParallelParse: Boolean;
    property ParallelParseThreads: Integer;
    // Workbook-level collections.
    property ActiveSheet: Integer;
    property Minimized: Boolean;
    property WindowHidden: Boolean;
    property ShowHorizontalScroll: Boolean;
    property ShowVerticalScroll: Boolean;
    property ShowSheetTabs: Boolean;
    property XWindow: Integer;
    property YWindow: Integer;
    property WindowWidth: Integer;
    property WindowHeight: Integer;
    property TabRatio: Integer;
    property FirstSheet: Integer;
    property AutoFilterDateGrouping: Boolean;
    property Date1904: Boolean;
    // Workbook calculation policy
    property Iterate: Boolean;
    property IterateCount: Integer;
    property IterateDelta: Double;
    property CalcId: Integer;
    property FullCalcOnLoad: Boolean;
    property CalcMode: WideString;
    property RefMode: WideString;
    property ForceFullCalc: Boolean;
    property CalcCompleted: Boolean;
    property CalcOnSave: Boolean;
    property FullPrecision: Boolean;
    property ConcurrentCalc: Boolean;
    property ConcurrentManualCount: Integer;
    function CreateWorkspaceWorkbook: IXLSWorkspaceWorkbook;
    procedure RegisterExternalWorkbook(const AWorkbookName: WideString;
      AWorkbook: TXLSXWorkbook);
    procedure UnregisterExternalWorkbook(const AWorkbookName: WideString);
    property SourceFormat: TXLSXFileFormat;
    property IndexedColor[Index: Integer]: LongWord;
    function  NearestIndexedColor(AArgb: LongWord;
      out AMatch: TXLSNearestIndexedColorMatch): Boolean;
    function  ScanIndexedColorUsage: TXLSIndexedColorUsageArray;
    function  BuildBiffPalettePlan: TXLSBiffPalettePlan;
    function  ApplyBiffPalettePlan(
      const APlan: TXLSBiffPalettePlan): Boolean;
    function  HasCustomIndexedColor(Index: Integer): Boolean;
    function  CustomIndexedColorCount: Integer;
    procedure ResetIndexedColors;
    property Sheets: TXLSXSheets;
    property Fonts: TXLSXFonts;
    property Fills: TXLSXFills;
    property Borders: TXLSXBorders;
    property NumberFormats: TXLSXNumberFormats;
    property Alignments: TXLSXAlignments;
    property DefinedNames: TXLSXDefinedNames;
    property ExternalLinks: TXLSXExternalLinks;
    property ExternalWorkspace: TXLSWorkbookWorkspace;
  end;
      

Members

SheetsWorksheet collection. See TXLSXSheets
FontsWorkbook-level font palette. Cells pick a font by setting TXLSXCell.FontIndex to a 1-based index into this collection. See TXLSXFont / TXLSXFonts
FillsWorkbook-level fill palette. Cells pick a fill by setting TXLSXCell.FillIndex to a 1-based index into this collection. See TXLSXFill / TXLSXFills
BordersWorkbook-level border palette. Cells pick a border by setting TXLSXCell.BorderIndex to a 1-based index into this collection. See TXLSXBorder / TXLSXBorders
NumberFormatsWorkbook-level custom number-format palette. Cells pick a format by setting TXLSXCell.NumberFormatIndex to a 1-based index into this collection. See TXLSXNumberFormat / TXLSXNumberFormats
DefinedNamesWorkbook-level named ranges (workbook-scoped or sheet-scoped). See TXLSXDefinedName / TXLSXDefinedNames
CalculateCompiles and evaluates an Excel formula string against the active sheet, accepting a leading = is accepted Cell references, ranges, formulas stored in referenced cells, cross-sheet references, defined-name ranges, and supported text, date, workday, engineering/base-conversion, bitwise, statistical, aggregate, and math functions are evaluated through the shared HotXLS formula engine See OnUserFunction to handle custom or unsupported functions
CreateLoadedCellCursorCallback used by xlckBlank when a formula calls a custom or unsupported function. See OnUserFunction / OnUserFunctionEx callback
CreateReadOnlyViewReads IXLSXWorkbookOwner and appends worksheet names to IXLSReadOnlyWorkbookView in workbook order without loading worksheet XML. The stream overload expects a complete XLSX package stream. Gives back the number of names read, or SheetCount when the package cannot be opened CreateReadOnlyView method
SaveSemanticSnapshot, ComputeSemanticHashStreams a versioned canonical workbook-semantic representation or computes its lowercase SHA-256 without materialising the complete snapshot. See semantic snapshot and hash methods
RenderCalibration, CaptureRenderCalibration, ResetRenderCalibrationAtomically assigns validated rendering calibration, captures an independent value snapshot for one operation, or restores defaults; the runtime configuration is not serialised and does not itself resize worksheet rows or columns. See render calibration values and snapshots
CreateRenderGeometryCreates an operation-owned geometry and font-measurement service with immutable calibration, workbook-generation and backend identity, plus a bounded local cache; AutoFit captures one service per operation and pagination captures one per build without touching worksheet dimensions. See render geometry and font measurement
OnUserFunction, OnUserFunctionExCallback used by Calculate when a formula calls a custom or unsupported function. See OnUserFunction / OnUserFunctionEx callback
AllowUnsafeFormulaCallbacksDefaults to false and stops dangerous external or macro-style function names from reaching user-function handlers before argument evaluation. See callback safety policy
GetSheetNames(FileName, AList), GetSheetNames(Stream, AList)Reads xl/workbook.xml and appends worksheet names to AList in workbook order without loading worksheet XML. The stream overload expects a complete XLSX package stream. Gives back the number of names read, or -1 when the package cannot be opened
AlignmentsWorkbook-level cell-alignment palette. Cells pick an entry by setting TXLSXCell.AlignmentIndex to a 1-based index into this collection. See TXLSXAlignment
Document propertiesTitle, Author, Subject, Keywords, Description, Category, LastModifiedBy, Company, Application, AppVersion, Created, Modified. Setting any single one of them populates docProps/core.xml + docProps/app.xml on SaveAs (otherwise the workbook keeps the minimal part set)
ProtectWorkbook / UnProtectWorkbookWorkbook protection toggle with an optional 16-bit legacy password hash and LockStructure / LockWindows flags. Reflected as <workbookProtection> in xl/workbook.xml
LoadVbaProjectFromFile / VbaProject / HasVbaProject / VbaProjectDefinedLoadVbaProjectFromFile imports a raw vbaProject.bin payload; VbaProject exposes the bytes; HasVbaProject and read-only VbaProjectDefined both report whether a payload is present. Save with a .xlsm extension when macros should be enabled by Excel
ParsedVBAProjectRead-only parsed view of the current vbaProject.bin payload. When the payload is a valid OLE VBA storage, returns a TXLSVBAProject exposing module names and source text; otherwise returns nil. The raw VbaProject payload remains the authoritative bytes used for SaveAs/Open round-trip
AddChartSheet(Name, Type, Title)Creates a worksheet flagged IsChartSheet = True and seeds Charts[0] with a sensible default full-page anchor. SaveAs writes such sheets to xl/chartsheets/sheetN.xml. See TXLSXChart
ParallelParseWhen True, SaveAs uses Open per sheet — no sheetXmls cache is held, sharedStrings.xml is emitted last once every sheet has populated the SST. Combined with the per-row
ParallelParseThreadsSets the maximum number of worksheet streams parsed concurrently during Open. Zero selects the automatic worker count, and positive values set an explicit cap. Active inflater and XML reader working sets are capped by this count
StreamingWriteWhen True, SaveAs uses WriteWorksheetXmlStreaming per sheet — no sheetXmls cache is held, sharedStrings.xml is emitted last once every sheet has populated the SST. Combined with the per-row TXLSWideStringBuilder this keeps memory linear on large sheets. Default is False (existing behavior)
PreserveUnsupportedParts / ClearUnsupportedPartsPreserveUnsupportedParts defaults to True and keeps unknown relationship-reachable package parts plus foreign workbook-root namespace declarations, markup-compatibility attributes, and complete workbook-level <extLst> payloads during Open and SaveAs. Relationship references inside the preserved extension payload are remapped when generated IDs clash with the source. Set the property to False before Open, or call ClearUnsupportedParts, to discard this state. The UnsupportedPartCount and UnsupportedPartBytes diagnostics count preserved package parts and leave out inline workbook XML metadata
PreserveRawPartsthis keeps memory linear on large sheets. Default is False (existing behaviour)
SaveAsEncrypted / OpenEncrypted / CanReadEncryptedECMA-376 Standard Encryption write support SaveAsEncrypted writes a standard-conforming AES-128 protected OLE Compound File container for non-empty passwords, using AES-NI acceleration when available and a portable software fallback otherwise. The encrypted output opens in Excel 2007 and later with the password used to save it CanReadEncrypted detects the OLE2 magic bytes; OpenEncrypted transparently falls back to plain Open for unencrypted files and still raises EXlsxEncryptionNotImplemented for encrypted packages until decrypt support lands
SaveAs(FileName)Writes the workbook to the given file. Returns 1 on success, negative on failure. If the workbook has no sheets a default Sheet1 is added before writing
This overload and SaveAs(FileName, FileFormat) stage their output before the destination is replaced If replacement fails, the return value is -1 and LastDiagnostic reports xlsDiagnosticOutputCommitFailed (1005), the original Windows NativeCode, and its system error message The old destination and workbook FileName remain unchanged; temporary output is released and a later save clears the earlier diagnostic
SaveAs(FileName, FileFormat)Accepts xlsxOpenXMLWorkbook for ordinary OOXML output, xlsxOpenDocumentSpreadsheet for ODS, xlsxOpenXMLTemplate for a macro-free XLTX template, or xlsxOpenXMLMacroEnabledTemplate for an XLTM template, with buffered and streaming output supported for every OOXML choice
Template output writes application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml for /xl/workbook.xml; use the .xltx extension for files and application/vnd.openxmlformats-officedocument.spreadsheetml.template when serving the package over HTTP
The format must be chosen explicitly: neither the file extension nor an imported template changes the default SaveAs output
If a VBA project is present, XLTX output returns -1 with an unsupported-format diagnostic before writing the destination; XLTM keeps an existing VBA project and also accepts a workbook without macros
SaveAsODS remains the named shortcut for ODS output with optional TODSExportOptions control
GetConversionReport / SaveAsCheckedInspect a caller-owned, mutation-free known-feature conversion report, or turn away degraded and dropped features before writing by leaving AllowLossy=False Explicit lossy saving still rejects unsupported conversions; see calculation and conversion fidelity for target, ownership, diagnostic, and preservation boundaries
SaveAs(Stream) / SaveAs(Stream, FileFormat)Writes the workbook directly into any TStream, and the FileFormat overload accepts xlsxOpenXMLWorkbook, xlsxOpenDocumentSpreadsheet, xlsxOpenXMLTemplate, or xlsxOpenXMLMacroEnabledTemplate, covering in-memory OOXML workbooks, ODS spreadsheets, XLTX templates, or XLTM templates. Returns 1 on success, and stream saves honour RecalcBeforeSave: manual mode preserves existing formula caches, whilst the dirty and always policies refresh them before serialisation. The caller retains stream ownership; cancellation before writing begins preserves its contents and position, whilst a failure after serialisation starts can leave partial output
Open(FileName)Reads an OOXML .xlsx archive and replaces the Sheets collection with its contents. Returns 1 on success
Open(FileName, Password)Reserved for future encrypted XLSX support. Behaves like Open(FileName) today — the password is ignored
Open(Stream)Reads an OOXML .xlsx archive from a TStream. Returns 1 on success
OpenCSV(FileName) / OpenCSV(Stream)Imports CSV or TSV text into the workbook with automatic separator detection (,, ;, tab, or pipe), BOM-based UTF-8 / UTF-16 encoding detection, RFC 4180-style quoted fields, and optional value-type inference through the ADetectTypes overloads. Calling Open(FileName) on .csv or .tsv routes to this importer automatically. See OpenCSV method
OpenODS(FileName) / OpenODS(Stream)Imports an OpenDocument Spreadsheet (.ods) package from a file or stream. The reader loads content.xml, shared style information from styles.xml, and view settings when present, preserving sheet names, scalar values, cached formula results, basic formula reference conversion, repeated rows/columns/cells, merged ranges, rich text, hyperlinks, comments, embedded images, embedded charts, hidden rows/columns/sheets, row heights, column widths, inherited/default styles, number/date/time/currency/scientific/fraction formats, cell and sheet protection state, named ranges, print areas, manual page breaks, freeze panes, AutoFilter ranges, row/column outline groups, headers/footers, data validations including prompts, conditional formats including formulas/colour scales/data bars, and sheet tab colour. Full OpenFormula semantics, ODS protection keys, comment geometry, advanced comment formatting, and package features outside spreadsheet content are not converted
SaveAsODS(FileName) / SaveAsODS(Stream), with optional TODSExportOptionsIt writes the ODF mimetype, manifest, metadata, styles, and worksheet content directly, carrying typed values, formulas, styles, rich text, dimensions, merges, hyperlinks, images, charts, named ranges, AutoFilter ranges, conditional formats, data validations, freeze panes, page setup, headers/footers, print ranges, manual page breaks, outline groups, tab colour, and sheet visibility where the HotXLS workbook model represents those features. Passing export options, including nil, retains the normal recalculation policy, progress cancellation, diagnostics and write protection. File output stages a sibling file and replaces the destination only after successful serialisation; serialisation failure and cancellation before commit preserve the prior destination. Writing progress reports each completed table, and ppsEnd is a terminal notification whose Abort request cannot cancel an already completed save. Stream output retains caller ownership and the ordinary stream-save behaviour, which can leave partial output after serialisation has begun
TODSExportOptionsControls ODS export Generator overrides the meta:generator value in meta.xml; an empty value uses the built-in HotXLS generator string IncludeCharts and IncludeImages default to True and, when False, remove the matching drawing frames, package parts, and manifest entries together so the output has no orphan chart or image references. The caller owns the options instance and must free it when done
GetODSSheetNames(FileName, AList), GetODSSheetNames(Stream, AList)Reads only ODS table names from content.xml into AList without resetting or populating the workbook. Use it when a file picker or import workflow needs the sheet names before loading the workbook
SaveAsCSV overloadsFour overloads (FileName or Stream × active-sheet default / explicit SheetIndex + Delimiter). Writes the chosen sheet out as a UTF-8 CSV with BOM. Date values render as yyyy-mm-dd hh:nn:ss; formula cells are calculated before export, and formula text is used only when calculation is not available Returns 0 on success
SaveAsHTML overloadsOptions overloads accept TXLSXHtmlExportOptions for Title, WriteDocument, IncludeStyles, IncludeBOM, and TableClass. Set WriteDocument to False for a table fragment; set IncludeBOM to False when embedding output in an existing UTF-8 response. Exported output now keeps cell hyperlinks as <a> anchors and anchored images as inline data: image URIs; workbook-level export emits anchors outside populated cells. Cell comments are also emitted as escaped <td>title attributes, and workbook-level export includes comment-only anchors. When IncludeStyles is enabled, explicit ColWidth values are emitted as <col> widths and explicit RowHeight values as <tr> height styles. Rich-text cell runs are emitted as escaped <span> elements with inline font, colour, emphasis, and underline styles when IncludeStyles is enabled. Cell borders are emitted as CSS border-left, border-right, border-top, and border-bottom rules when IncludeStyles is enabled. Hidden rows and columns marked by RowHidden / ColHidden, plus explicit zero-width columns, are skipped in the generated table and <colgroup>. Vertical alignment settings are emitted as CSS vertical-align rules when IncludeStyles is enabled
SaveAsRTF overloadsFour overloads (FileName or Stream × active-sheet default / explicit SheetIndex). Writes the chosen sheet as an RTF 1.6 document with a plain table. Column widths come from ColWidth data (1 char unit ≈ 96 twips; default 809 twips). Per-cell bold / italic / font size are applied; non-ASCII characters get encoded as signed-16-bit \uN? RTF unicode escapes. Merged cells are not spanned. Returns 0 on success
ActiveSheet1-based index of the active (selected) sheet (0 when none), in line with the classic XLS engine's ActiveSheetIndex. SaveAs writes activeTab="N" on <workbookView> (the OOXML activeTab attribute itself stays 0-based) when workbook view options need to be emitted, and tags the matching sheet with tabSelected="1"
Minimized / WindowHidden / ShowHorizontalScroll / ShowVerticalScrollWorkbook-window chrome flags written to <workbookView>. Minimized writes minimized="1", WindowHidden writes visibility="hidden", and ShowHorizontalScroll / ShowVerticalScroll hide or show the workbook scrollbars Open round-trips all four values
XWindow / YWindow / WindowWidth / WindowHeightWorkbook-window geometry written to <workbookView>. XWindow and YWindow store the window origin, while WindowWidth and WindowHeight store its size. Values are clamped to 0..65535 and round-trip on load
ShowSheetTabs / TabRatio / FirstSheet / AutoFilterDateGroupingWorkbook-window view options written to <workbookView>. ShowSheetTabs hides or shows the sheet-tab bar, TabRatio controls the tab-bar-to-scrollbar width split and clamps to 0..1000, FirstSheet selects the first visible tab as a 0-based sheet index and clamps it to an existing sheet, and AutoFilterDateGrouping controls Excel date grouping in AutoFilter dropdowns Open round-trips all four values
Date1904Workbook date base False (default) = Windows 1900 epoch; True = Mac 1904 epoch (shifts every date serial by 1462 days). Set this before assigning TDateTime cell values so Excel renders the same calendar date
Iterate / IterateCount / IterateDeltaControls iterative circular-reference calculation IterateCount is clamped to 1..32767 and defaults to 100 IterateDelta accepts non-negative finite values and defaults to 0.001 Non-default limits stay in force even when Iterate is currently False
CalcMode / RefMode / CalcIdControls the workbook calculation mode, formula reference style, and calculation engine identity CalcMode accepts auto, manual, or autoNoTableRefMode accepts A1 or R1C1 with case-insensitive input and canonical output Modern rich-error output emits CalcId of at least 191029 so Excel interprets cached modern errors, keeping higher requested values and leaving the in-memory property unchanged
FullCalcOnLoad / ForceFullCalc / CalcCompleted / CalcOnSave / FullPrecisionControls full recalculation, cached-calculation completion, recalculation before save, and precision policy Each non-default value independently emits and round-trips the matching <calcPr> attribute
ConcurrentCalc / ConcurrentManualCountControls concurrent workbook calculation and the manual worker-count hint ConcurrentManualCount is clamped to zero or greater
SourceFormatReports the package family loaded by the most recent successful Open or OpenODS call, returning xlsxOpenXMLWorkbook for OOXML workbooks and templates, including XLTX and XLTM, xlsxOpenDocumentSpreadsheet for ODS, and xlsxExcelBinaryWorkbook for the supported XLSB values-and-styles subset
A newly created workbook reports xlsxOpenXMLWorkbook until a file is opened, and this property does not select the output format
IndexedColor[Index]ARGB value for the given OOXML indexed-colour palette slot (0..63). Reading returns the user override if set, otherwise the built-in OOXML default (XlsxDefaultIndexedPalette) Writing overrides slot N; SaveAs then emits a full <indexedColors> block with all 64 slots
ResolveIndexedColorClassifies public color indexes, BIFF icv values, or OOXML indexed colours and resolves a normalised ARGB value when the workbook palette or an explicit system-colour callback supplies one
NearestIndexedColorReturns the nearest physical palette entry via the shared cached OKLab matcher without changing the palette or workbook state
ScanIndexedColorUsageReturns a deterministic 56-slot inventory with palette colours, definition and reference counts, consumer kinds, and preservation locks without materialising cells or changing workbook state
BuildBiffPalettePlanReturns a mutation-free 56-slot BIFF palette plan with locked slots, aggregated true-colour targets, deterministic mappings, source identity, and weighted OKLab error statistics
ApplyBiffPalettePlanValidates source identity, slot metadata, locks, and opaque targets before atomically applying every changed palette entry and rebuilding the cached matcher once
HasCustomIndexedColor / CustomIndexedColorCount / ResetIndexedColorsHasCustomIndexedColor(N) returns True when slot N was explicitly overridden CustomIndexedColorCount returns the number of overridden slots (0 = no <colors> block emitted by SaveAs) ResetIndexedColors discards every override and restores the default palette
ExternalLinksCollection of external workbook references. Each TXLSXExternalLink entry holds a Target URL and a SheetNames list. SaveAs emits the <externalReferences> block in xl/workbook.xml and the corresponding xl/externalLinks/ parts. Open round-trips the Target and SheetNames; cached cell values inside <sheetDataSet> are not preserved
CreateWorkspaceWorkbookReturns the revocable IXLSWorkspaceWorkbook adapter for this workbook The adapter keeps the workbook source identity and generation and disconnects before the workbook model is destroyed
ExternalWorkspaceThread-safe path-preserving registry consumed by live external-formula evaluation Exact identities and aliases are preferred, ambiguous basename lookup is refused, and identity normalisation performs no implicit file or network access See Live workbook workspace
RegisterExternalWorkbook / UnregisterExternalWorkbookCompatibility facade over ExternalWorkspace Registration maps an unambiguous supplied name to the workbook's stored relationship target, keeps paths and extensions distinct, and refuses collisions Unregistration removes the requested registration; target destruction also revokes the adapter safely

Example

Writing and re-opening a workbook:
uses lxHandleX;

var
  wb: TXLSXWorkbook;
begin
  wb := TXLSXWorkbook.Create;
  try
    wb.Sheets.Add('Demo').Cells.Item[1, 1].Value := 'Hello';
    wb.SaveAs('demo.xlsx');

    wb.Open('demo.xlsx');
    ShowMessage(wb.Sheets[0].Cells.Item[1, 1].Value);
  finally
    wb.Free;
  end;
end;
    

See also