HotXLS documentation / API reference

Compound file storage

lxCompoundFile reads and writes Compound File Binary containers through Pascal streams, including nested storage scopes, MiniFAT payloads and chained DIFAT sectors; native Classic BIFF8 workbook APIs use this backend on Linux and macOS

Use ordinary workbook Open and SaveAs calls for spreadsheet work; the lower-level APIs below are useful for inspecting nested streams, building containers and preserving storage metadata

Read or build a container

TlxCompoundFile.LoadFromStream(AStream, AOwnsStream) loads directory and allocation metadata; AOwnsStream defaults to False, and the backing stream must remain available while extracting its contents

CreateNew(AStream, AOwnsStream) prepares a new container, AddStorage and AddStream queue its contents, and Save writes a version-3 container with any required DIFAT extension sectors

MemberBehavior
RootIndexThe root directory entry identity, used as the parent for top-level storage and streams
AddStorage(Name, ParentIndex)Queues a nested storage and returns its directory identity for adding children
AddStream(Name, Data)Queues a root-level byte stream
AddStream(Name, Data, ParentIndex)Queues a byte stream in the selected parent scope and returns its identity
OpenStream(Name), OpenStream(Name, ParentIndex)Extract a root or scoped stream into an owned TlxCfbStream; a missing stream returns nil
OpenEntryStream(Index)Extracts a directory stream by identity; an invalid or non-stream entry returns nil
HasStream(Name), HasStream(Name, ParentIndex)Test stream presence in the root or selected parent scope
FindStorage(Name, ParentIndex)Returns a storage identity in the selected parent, or -1 when no matching storage exists
EntryCount, Entries(Index)Inspect loaded directory entries; indexes are zero-based and must be valid
SetEntryMetadata(Index, Entry)Copies only class ID, state bits and timestamps into a valid queued entry or root; structural identities and payloads remain unchanged

The TlxCfbEntry record exposes Name, EntryType, StartSector, Size, LeftSibling, RightSibling, Child and derived ParentIndex; directory links are indexes, and -1 indicates an absent identity

Its metadata fields are ClassID, StateBits, CreationTime and ModificationTime; timestamps retain raw FILETIME ticks from the 1601 UTC epoch rather than a locale-formatted date

TlxCfbEntryType includes cfbEmpty, cfbStorage, cfbStream and cfbRoot; TlxCfbStream exposes Name, Size, Data, Read, Seek and CopyTo

Extracted streams own detached bytes and must be freed by the caller; corruption, incomplete chains, invalid ownership and cyclic directory or allocation graphs reject instead of returning truncated payloads

lxCfbCompareNames(A, B) applies Compound File Binary length-first ordering with pinned simple BMP uppercase mapping; duplicate names are scoped to their parent, and identical names in separate nested storages remain distinct

Native storage interfaces

On non-Windows targets, lxOLE supplies the storage interface implementation required by Classic workbook loading and saving; its IStorage, IStream and IEnumStatStg retain explicit interface ownership and detached native container state

Factory or helperContract
XlsOpenCompoundStorage(Source, Storage)Loads a read-only container beginning at stream offset zero
XlsOpenCompoundStorage(Source, Start, Storage)Loads the container beginning at the explicit nonnegative offset
XlsCreateCompoundStorage(Storage)Creates writable native storage with nested scopes and streams
XlsWriteCompoundStorage(Storage, Destination)Serializes the native root storage to the supplied stream; foreign implementations and non-root storage reject
XlsFreeCompoundStorageName(Name)Frees native names returned by storage statistics or enumeration; nil is accepted

The factories return HResult; test Succeeded(Result) before using the returned interface, and release interface references when finished

Read-only mutation fails, cloned stream cursors retain independent positions, and nested copies preserve parent identity and supported metadata; direct serialization does not provide the higher-level workbook destination transaction contract

Canonical workbook identifiers

XlsIdentifierKeyText(const A: WideString): WideString in lxStandard returns the UTF-16 text representation of the existing pinned Unicode identifier key, allowing Classic defined-name storage to share canonical equality with other workbook engines

This key representation is for identity and lookup rather than displayed spelling; authored names remain unchanged, and the CFB directory comparator retains its separate format-mandated ordering

See Free Pascal support for native build requirements and the verified BIFF8 workbook contract, and Classic encryption for supported encryption and plaintext property-stream behavior