HotXLS Docs

XLSB formulas and worksheet objects

The XLSX workbook facade reads and writes a validated XLSB subset with typed values, ordinary cached formulas, names, common styles and represented worksheet objects; unrepresented state is refused before any destination output

Open and save

if Workbook.Open('values.xlsb') <> 1 then
  raise Exception.Create('XLSB input is unsupported or invalid');
if Workbook.SaveAsChecked('values-copy.xlsb', xlsxExcelBinaryWorkbook) <> 1 then
  raise Exception.Create('XLSB output is unsupported or failed');

Open identifies the workbook part's content and registered type; successful binary input sets SourceFormat=xlsxExcelBinaryWorkbook, whilst the original four TXLSXFileFormat ordinals stay unchanged and the new member carries ordinal 4

The file and stream SaveAs and SaveAsChecked overloads take the binary format explicitly; default saving still picks the ordinary Open XML workbook format whatever the filename extension says

GetConversionReport(xlsConversionExcelBinaryWorkbook) inspects the current state without expanding packed cell storage; unsupported entries stay mandatory failures even for unchecked saving or AllowLossy=True

Supported state

The conversion report covers live-model features, and full package validation remains the final gate for invalid references, malformed records, unfamiliar attributes or unsupported retained content

Binary import keeps the file's explicit default font and the supported built-in number formats, styled blank cells included; locale-dependent number formats call for an explicit format code so the reader never guesses regional formatting

Explicit boundaries

Shared formula records, array and dynamic-array ownership, array constants and array-returning functions, future functions, user-defined functions, external-workbook and multi-sheet references, VBA, external data connections, PivotTables and Slicers, charts and drawings, comments and rich text, validation, conditional formatting and advanced page or extension metadata all sit outside this backend

Table calculated columns, total aggregation formulas, sort state, differential or custom table formatting, query-bound tables and XML mappings are refused; colour, icon, dynamic and date-group filters, typed native Boolean custom criteria, numeric-looking native string custom criteria and filter button visibility overrides are likewise refused

Imported non-custom worksheet filter criteria are kept as RawXml; custom comparisons fill in the existing typed criterion properties, whilst selected values and blank selection remain an XML-backed criterion rather than a new typed value-list API

Formula token conversion preserves semantics and reference flags; it may normalise formula text with parentheses and quoted sheet names, so byte-for-byte text identity is promised to nobody

Formula output demands an explicit numeric, string, Boolean or ordinary error cache; a missing cache is refused when the save policy will not recalculate, xrmManual and a clean dependency graph with xrmIfDirty included; applications can call Recalculate or pick xrmAlways before saving, and empty string, False and numeric zero all count as valid caches

Calculation properties must stick to the supported defaults; manual calculation, iteration, reduced precision, alternate reference mode, forced or incomplete calculation, explicit thread configuration and other meaningful nondefault settings are refused

Calculation chains and binary cell indexes are regenerated metadata and are never copied across the package bridge; unfamiliar feature records or relationships remain failures rather than becoming fabricated Open XML parts

Binary input demands eager full-sheet loading; MetadataOnly and a nonempty SelectedSheets list are refused before the existing model is replaced, because lazy loading would need a retained converted archive

Failure and ownership guarantees

Binary packages are validated and converted before the ordinary XML parser resets the workbook; unsupported input, malformed binary content, refused read modes and conversion cancellation leave the existing worksheet objects, filename, source format and source archive binding intact

Once validated binary conversion hands over to the existing XML parser, late XML parsing or application callback failures follow the ordinary XML open lifecycle; the preflight guarantee promises no rollback of arbitrary callback writes

Saving stages the whole binary package; file output uses a sibling temporary file and one final replacement, and readable seekable stream output keeps a byte, size and position snapshot for rollback after a commit failure

LastSaveUsedStreaming=False reflects the complete binary staging even where the intermediate XML writer streams; memory covers converted parts and the whole package, so this backend is no bounded-memory streaming writer

Conversion reports and preflight keep packed cell storage, a mixture of packed values and materialised formulas included; successful saving can expand packed values through the existing style preparation and worksheet writer, so report purity implies nothing about an immutable or nonmaterialising save operation

Successful binary file saving clears any previous raw XML source bindings; stream saving keeps the filename behaviour, and cancellation is checked before the destination commit

Package conversion APIs

procedure XlsbToOpenXml(Source: TZipArchive; Destination: TStream;
  CancelCheck: TXLSStreamCancelCheck = nil;
  EntryCompressionLevel: Integer = -1; EntryFixedDate: TDateTime = 0);
procedure OpenXmlToXlsb(Source: TZipArchive; Destination: TStream;
  CancelCheck: TXLSStreamCancelCheck = nil;
  EntryCompressionLevel: Integer = -1; EntryFixedDate: TDateTime = 0);
function XlsbStylesToXml(const Data: AnsiString): AnsiString;
function XlsbStylesFromXml(const Data: AnsiString): AnsiString;
function XlsbStringsToXml(const Data: AnsiString): AnsiString;
function XlsbStringsFromXml(const Data: AnsiString): AnsiString;

TXlsbFormulaValidator.Create(WorkbookXml) validates the workbook name context and Validate(FormulaText, SheetIndex) validates a formula with no worksheet cell access; SheetIndex is zero-based and the validator belongs to the caller

XlsbValidateTableXml(Data) and XlsbValidateAutoFilterXml(Data) validate UTF-8 object XML against the same encoder contracts package output uses; failures raise the existing format or unsupported-feature exceptions

These lxXlsb APIs keep caller ownership; package conversion validates and stages every part before replacing Destination from offset zero, and the core-part bridges use UTF-8 XML and raw binary bytes

EXlsbUnsupported derives from EXlsbFormatError and tells expected subset rejection apart from malformed data; cancellation raises the established stream cancellation exception before commit

Compression accepts -1 through 9, and the fixed date takes zero or a finite DOS-representable date from 1980 through 2107; invalid options are refused before any destination changes