HotXLS documentation / API reference

Portable headless output

Available since version 2.384.100 as a bounded output pipeline with explicit capture and rendering APIs

Capture a supported rectangle from a Classic XLS or XLSX workbook on Windows, transfer its immutable snapshot, and render PDF, SVG or PNG on Linux or macOS with Free Pascal and native Cairo

The capture adapter uses the workbook engine; Windows capture uses its default geometry service, while native Linux and macOS capture can supply an explicit FreeType/HarfBuzz geometry service backed by application-selected font files

The separate native consumer accepts lxPortableRender scenes through lxPortableCairo, without Excel or a desktop session; its geometry API also uses the existing portable workbook-view and render-geometry units

The consumer accepts an immutable scene or transfer stream; platform requirements for loading and calculating workbooks are described separately in Free Pascal support

Capture an existing workbook rectangle

CaptureXLSPortableRenderSnapshot in lxPortableWorkbookCapture accepts an IXLSWorkbook or IXLSXWorkbookOwner, with explicit or default TXLSPortableRenderLimits; two additional overloads accept explicit limits followed by an IXLSRenderGeometry provider scoped to the capture view

SheetIndex and inclusive Row1, Col1, Row2, Col2 are one-based; the resulting snapshot stores zero-based positions relative to the captured rectangle

program CaptureRectangle;
{$APPTYPE CONSOLE}
uses SysUtils, Classes, lxHandleX, lxPortableRender,
  lxPortableWorkbookCapture;
var
  Workbook: TXLSXWorkbook;
  Owner: IXLSXWorkbookOwner;
  Snapshot: IXLSPortableRenderSnapshot;
  Stream: TFileStream;
begin
  Workbook := TXLSXWorkbook.Create;
  Owner := Workbook;
  if Workbook.Open('report.xlsx') <> 1 then
    raise Exception.Create('Cannot open report.xlsx');
  Snapshot := CaptureXLSPortableRenderSnapshot(Owner, 1, 1, 1, 30, 6);
  Stream := TFileStream.Create('report.hxrs', fmCreate);
  try
    SaveXLSPortableRenderSnapshot(Snapshot, Stream,
      XLSDefaultPortableRenderLimits);
  finally
    Stream.Free;
  end;
  Owner := nil;
end.

Keep the owner interface alive while using the workbook object; release the interface instead of manually freeing an interface-owned workbook

For Classic XLS, use TXLSWorkbook and IXLSWorkbook from lxHandle with the same capture call

Capture reads existing formula caches and rejects any formula in the rectangle without a cache; it never implicitly recalculates, fetches external data or interns new styles in the source workbook

Explicitly recalculate before capture when your application needs fresh formula results; an existing cache is rendered as stored, so capture does not certify its freshness

The operation holds a read view and checks the workbook generation before returning; its returned snapshot is detached from workbook ownership and remains usable after the workbook is released

Appearance and capture boundaries

The snapshot contains formatted display text, physical dimensions in points, resolved RGB colors, supported cell fonts and alignments, fills, borders and complete merged rectangles; hidden rows and columns have zero size

Supported font appearance includes bold, italic, single underline and strikeout; supported cell appearance includes solid fills, left/center/right horizontal alignment, top/center/bottom vertical alignment, wrap, shrink and right-to-left reading order

Thin, medium, thick, hair, double, dotted, dashed and medium-dashed workbook borders map to the portable border styles and point widths; other border styles reject

Supported rich text carries effective run fonts, point sizes, RGB colors, bold, italic, single underline, strikeout, and run-level superscript or subscript; plain cell outline/shadow/vertical font effects, unsupported underline styles, gradient or patterned fills, diagonal borders, indent, text rotation and unsupported alignments reject

A capture rectangle must contain each merged cell completely; clipped, overlapping or inconsistent merges and incompatible styles along a merged outside edge reject

Sheet backgrounds and unsupported sheet kinds reject the capture; supported PNG/JPEG images and ordinary rectangle/ellipse text shapes in both workbook facades are captured as ordered scene objects, together with XLSX cell images, Boolean checkboxes and the supported cached XLSX chart subset described below; unsupported charts, shape presets, WordArt, grouped transforms, floating controls, Slicers, Timelines and sparklines reject when their resolved footprints intersect the rectangle

Unsupported content with a reliably resolved footprint outside the rectangle can coexist with capture; an unresolvable drawing footprint rejects rather than silently omitting potentially overlapping content

Classic table styling intersecting the rectangle rejects; XLSX built-in and supported custom Table sections are resolved in detached style context, with section-sized stripes and direct cell format overrides

For supported imported Table solid or implicit differential fills, RGB bgColor supplies the visible background; RGB fgColor alone leaves the inherited background unchanged, and a section carrying both colors uses its background color

Imported Table sections containing appearance that the typed summary cannot represent reject when that section applies, including underline, number formats, explicitly cleared bold/italic, font schemes, an explicit no-fill pattern and unsupported color forms; an unrelated section outside the captured rectangle does not block capture

Supported conditional formatting is applied without formula evaluation: cached numeric or date comparisons against literal numeric bounds, literal Boolean or numeric expressions, text containment/prefix/suffix rules, blanks and errors; higher-priority appearance wins per supported property, and XLSX StopIfTrue stops lower-priority matching rules

Classic text rules require a literal string needle and match cached string cells; XLSX text rules use their stored text criteria

Supported differential appearance includes resolved theme colors with tint and plain indexed colors; imported automatic colors, non-theme tint, a differential fill carrying both foreground and background colors, and unsupported border, alignment, strike or other unrepresented differential appearance reject when the matching rule applies

Conditional formulas requiring evaluation, aggregate or date-dependent rules, color scales, data bars and icon sets reject where encountered; overlapping conditional-format rule counts are bounded

Date1904 conversion chooses the applicable raw numeric-format section before applying the calendar offset; inactive calendar sections do not change ordinary numeric display, and Boolean values remain Boolean

A selected Date1904 calendar section combined with format conditions or elapsed-time constructs rejects; quoted or escaped section separators also reject, and this boundary does not block a selected ordinary numeric section merely because another section is a calendar format

Rich text and ordered drawing scenes

TXLSPortableCell.RichText is an array of TXLSPortableTextRun records containing Text, FontFamily, FontSizePoints, FontStyles, ColorRGB and BaselineShiftPoints; concatenated run text must equal the cell display text exactly

XLSX runs inherit omitted properties from the effective captured cell font, including supported table and conditional formatting; explicitly assigned false flags and explicit none/baseline/automatic color values override inheritance

Native shared strings and inline strings preserve run boundaries and whitespace; unsupported native font children, attributes, namespaces, theme/indexed rich colors and phonetic annotations reject instead of silently losing visible appearance

Classic runs resolve their stored BIFF font indices to full effective run fonts; phonetic metadata and unsupported run fonts reject, and capture retains workbook generation and style pools

Classic text shapes read existing OfficeArt properties and TXO font runs without creating drawing wrappers or changing the workbook; anchors use real row/column dimensions and offsets, supported solid fills and outlines retain their colors and widths, and embedded PNG/JPEG bytes are detached before transfer

Rectangle text uses the native 7.2pt horizontal and 3.6pt vertical margins; ellipse text additionally uses its inscribed text rectangle, keeping ordinary text inside the shape outline in both workbook facades

Imported Classic rectangle and ellipse containers retain their typed text and formatting; skipped native shape or group metadata with no resolved footprint rejects the capture explicitly, while unknown object-tail records, drawing extensions, rotation, non-solid fills and unsupported line styles reject an intersecting object

Imported XLSX two-cell rectangle and ellipse anchors support explicit RGB solid fills with alpha, solid or dashed/dotted outlines, physical anchor offsets and a single ordinary rich-text paragraph; each run retains its effective typeface, point size, color, bold, italic, single underline and strikeout, including explicit bold or italic resets

The imported shape reader reserves raw XML scratch storage before parsing and checks item, byte and text budgets cooperatively; it retains workbook drawing order and read leases without creating shape models or absent cells

Unknown native shape properties, effects, themes, rotations, grouped transforms, multiple paragraphs and unsupported anchor kinds reject explicitly; a resolved unsupported footprint outside the capture rectangle does not block the requested region

Run-level superscript and subscript use two-thirds of the run font size and a baseline shift of one-third of its original point size; a style boundary splitting a Unicode shaping cluster, or a CRLF sequence crossing incompatible run boundaries, rejects during native layout

TXLSPortableSceneObject carries a Kind, point-based X, Y, Width, Height, clipping rectangle, fill/outline colors and opacity, optional path points, text cell, or encoded raster bytes and dimensions

TXLSPortableSceneKind contains xpskRectangle, xpskEllipse, xpskPolyline, xpskPolygon, xpskText, xpskPNG and xpskJPEG; array order is drawing order, with later objects covering earlier objects

The additional CreateXLSPortableRenderSnapshot overload accepts a TXLSPortableSceneObjects array; query IXLSPortableRenderSceneSnapshot for zero-based Objects and ObjectCount, whose getters return detached copies including run, point and raster arrays

Cell images and checkbox paths precede floating drawings; floating drawings retain workbook order, physical anchors and viewport clipping, and text shapes use the minor theme font at 11 points with 7.2-point horizontal and 3.6-point vertical text margins

PNG and JPEG images are decoded natively after header, pixel-size and byte preflight; supported floating images retain transparency and stretch geometry, while cell images fit inside the cell or complete merged rectangle with their aspect ratio preserved

Crop, rotation, shadows, luminance/gamma adjustment, tiling, SVG companions and live camera bindings remain unsupported; preserved image XML is validated against the supported appearance, so hidden images, unknown nested metadata, foreign namespaced properties, nonrectangular image geometry and unmodeled transforms reject only when their footprint overlaps capture

Boolean cell checkboxes use a theme-neutral vector box and optional check mark, including effective controls inherited from row and column formats; the requested cell walk is bounded before traversal, other control kinds and blank or non-Boolean checkbox values reject, and supported cell scenes suppress scalar Boolean or image-error fallback text

A checkbox default is insertion metadata and does not manufacture a Boolean for an absent cell; explicit direct-cell control clearing masks an inherited control, while capture reads preserve sparse absence and the workbook generation

XLSReadPortableImageDimensions validates a bounded PNG IHDR or supported eight-bit sequential/progressive JPEG frame and returns its declared width and height; decoding remains the renderer's responsibility

IXLSPortableSceneCaptureSource.ReadPortableSceneObjects uses one-based workbook coordinates and point-based scene coordinates relative to the range, validates the range and cooperative limits, and returns consumed byte, text and item counts; HasPortableCellScene identifies cells whose scalar display is replaced by their captured scene

Native layout CellCount counts grid cells and LineCount also includes text scene objects; a text object's line CellIndex is CellCount plus its zero-based sequence among text scene objects, while GetCellGeometry remains restricted to grid cells

Scalar snapshots continue to serialize as HXRSNP01; snapshots containing runs or scene objects serialize as HXRSNP02, and the loader accepts both versions with the same immutable ownership and input-position rollback contract

The combined item budget counts stored cells, rich runs, scene objects and path points; byte limits account for staged and detached arrays, text, encoded raster payloads and bounded native metadata inspection before allocation

Portable snapshot API

SymbolContract
EXLSPortableRenderException raised for invalid snapshot data, unsupported capture appearance, unavailable native backend, resource limits or rendering failures
TXLSPortableFontStyle, TXLSPortableFontStylesxpfsBold, xpfsItalic, xpfsUnderline and xpfsStrikeout, combined as a set
TXLSPortableHorizontal, TXLSPortableVerticalxphLeft, xphCenter, xphRight and xpvTop, xpvCenter, xpvBottom
TXLSPortableBorderStyle, TXLSPortableBorderxpbsNone, xpbsSolid, xpbsDashed, xpbsDotted and xpbsDouble; each border carries Style, WidthPoints and ColorRGB
TXLSPortableCellZero-based Row/Column, positive RowSpan/ColumnSpan, display Text, FontFamily, FontSizePoints, FontStyles, TextColorRGB, FillColorRGB, HasFill, WrapText, ShrinkToFit, RightToLeft, Horizontal, Vertical and four LeftBorder/TopBorder/RightBorder/BottomBorder records
TXLSPortableCells, TXLSPortableSizesDynamic arrays of stored cells and physical row/column sizes in points
TXLSPortableRenderLimitsMaxGridCells, MaxStoredCells, MaxBytes and MaxTextCharacters bound construction, capture and serialization
XLSDefaultPortableRenderLimitsReturns 2000000 grid cells, 2000000 stored cells, 67108864 bytes and 16777216 UTF-16 text characters
XLSDefaultPortableCellInitializes a one-cell span with Calibri at 11 points and default zero-valued appearance; set its position and desired appearance before construction
CreateXLSPortableRenderSnapshotValidates and copies generation, row heights, column widths and stored cells into a detached immutable interface; cells must be unique, in row-major order, within bounds and have nonoverlapping spans
IXLSPortableRenderSnapshotRead-only Generation, RowCount, ColumnCount, CellCount, zero-based RowHeightPoints, ColumnWidthPoints and copied Cells records
Snapshot getter methodsGetGeneration, GetRowCount, GetColumnCount, GetCellCount, GetRowHeight, GetColumnWidth and GetCell expose the same values; invalid indexed access raises an exception
SaveXLSPortableRenderSnapshotValidates and serializes one snapshot to a bounded private buffer, then copies the complete HXRSNP01 or HXRSNP02 payload into the supplied stream at its current position
LoadXLSPortableRenderSnapshotReads the versioned little-endian snapshot with strict UTF-8 text, validates counts, geometry, styles and spans, and rejects trailing data; failure restores the input stream position

All limits must be positive; the validated maximum is 2000000 grid/stored cells, 1073741824 bytes and 268435456 text characters, with dimensions no larger than 1048576 rows by 16384 columns

MaxGridCells counts the entire rectangle, including unstored blank cells; CellCount counts stored visible cells and merged anchors, and can be smaller

Generation records the source generation or an application-supplied value; it is metadata rather than a live link to a workbook or an automatic freshness check

Native rendering and explicit fonts

XLSPortableCairoBackendAvailable reports availability of the compiled native backend; native output requires Free Pascal on Linux or macOS, with Cairo, FreeType, HarfBuzz and FriBidi libraries available to the process

macOS builds link the four native libraries explicitly; a private dependency prefix and an explicit child-process loader path can supply them without changing shared compiler settings or shell profiles

Windows Delphi XE5, Win32 and Win64 can compile the portable interfaces and use snapshot serialization, but native Cairo layout preparation reports backend unavailability there

Pass an explicit font chain to PrepareXLSPortableCairoLayout; the renderer tries matching family and bold/italic style first, then same-style fallbacks in supplied order, requiring glyph coverage for each supported text cluster

Supply the actual regular, bold, italic and bold-italic files your captured content requires; no system-font discovery or synthetic bold/italic substitution occurs, and missing files, style mappings or glyph coverage reject

Font bytes are captured before shaping, so changing a file affects later layouts while an existing layout retains its captured bytes; FaceIndex selects the nonnegative face in a font file or collection

Native operations are serialized for FreeType face safety; immutable snapshots and prepared layout inspection do not require a live workbook

Fonts[0].FamilyName := 'Calibri';
Fonts[0].FileName := '/srv/fonts/Regular.ttf';
Fonts[0].FaceIndex := 0;
Fonts[0].Bold := False;
Fonts[0].Italic := False;

Here Calibri is an explicit family alias for the chosen file, allowing an application-controlled font mapping; inspect output metrics when mapping to a different font

The renderer supports hard line breaks, four-space tab expansion, paragraph bidirectional ordering, shaped ligatures and combining marks, greedy wrapping and shrink-to-fit; wrap takes precedence over shrink

Wrapping preserves the implemented combining-mark, variation-selector, ZWJ and virama cluster boundaries and favors spaces and ideographic spaces; it is not a complete UAX #29 grapheme implementation or Unicode line-breaking algorithm, and regional-indicator and Hangul-Jamo wrapping boundaries are not guaranteed

Font sizes resolve to 1/64 point and text clips to cell bounds; PDF embeds explicit fonts with logical text mappings, SVG uses vector glyph paths, and PNG draws the same positioned glyphs at the requested DPI

Prepare and inspect a layout

SymbolContract
TXLSPortableFontFile, TXLSPortableFontFilesOne explicit mapping contains FamilyName, FileName, FaceIndex, Bold and Italic; the dynamic array is ordered and contains between 1 and 64 mappings
TXLSPortableCairoFormat, TXLSPortableOutputFilesxpcfPDF, xpcfSVG or xpcfPNG, and an array of output filenames returned by file save
TXLSPortableCairoOptionsPage width/height, four margins, cell padding and raster DPI, plus page, glyph, line, layout, output, font, shaping and drawing limits
XLSDefaultPortableCairoOptionsInitializes every option with bounded defaults; use it before overriding individual fields
PrepareXLSPortableCairoLayoutValidates and copies a snapshot, captures explicit font bytes, and returns an owned prepared TXLSPortableCairoLayout; release it with Free
TXLSPortableCairoLayoutExposes PageCount, LineCount, CellCount, GetTextLine, GetCellGeometry, SaveToStream, Save and Destroy
TXLSPortableTextLineInfoA copied line record has CellIndex, GlyphCount, XPoints, BaselinePoints, WidthPoints, FontSizePoints and logical Text
TXLSPortableCellGeometryA copied rectangle has XPoints, YPoints, WidthPoints and HeightPoints in the full layout
GetTextLine(Index), GetCellGeometry(Index)Zero-based indexed inspection of prepared lines and stored cells; invalid indices reject

Pagination clips fixed printable-area tiles in across-then-down order; a cell or text fragment crossing page boundaries appears on every intersecting page, without automatic whole-cell fitting, worksheet print-title repetition or workbook page-setup interpretation

Renderer options and bounds

FieldsDefaults and meaning
PageWidthPoints, PageHeightPoints595 by 842 points
MarginLeftPoints, MarginTopPoints, MarginRightPoints, MarginBottomPoints36 points each; margins must leave a positive printable rectangle
CellPaddingPoints, RasterDPI2 points and 96 DPI; DPI affects PNG dimensions
MaxPages, MaxGlyphs, MaxLines256 pages, 2000000 shaped glyphs and 200000 text lines
MaxLayoutBytes268435456 bytes for bounded layout work and raster surface checks
MaxOutputBytes268435456 bytes per rendered output buffer, covering the complete PDF or one SVG/PNG page rather than the sum of separate page files
MaxFontBytes134217728 bytes across explicit font input files for a layout
MaxShapedCharacters, MaxDrawOperations16000000 each, bounding shaping work and page-by-cell drawing work

Invalid or non-finite geometry and nonpositive work budgets reject; page dimensions are capped at 100000 points and raster DPI at 1200, with additional byte, count and raster-area checks before rendering

The native process-wide font-byte pool additionally allows at most 256 distinct buffers and 256 MiB; exact identical bytes may share storage, and capacity is released only when the actual Cairo-owned font face releases its buffer

Free each layout when finished; the library does not reset shared Cairo caches, and a logically completed layout may leave font bytes resident while native Cairo still owns a face

Write output and handle failures

SaveToStream(Stream, Format, PageIndex = 0) writes all pages for PDF, requiring PageIndex = 0; SVG and PNG write the selected zero-based page

Snapshot serialization and native rendering complete in private bounded buffers before copying to the destination stream; validation or render failures preserve it, but a caller stream write failure can leave partial bytes and follows that stream's own failure behavior

Save(FileName, Format) writes one PDF file or one SVG/PNG file per page and returns their paths; multipage filenames insert -0001, -0002 and subsequent suffixes before the extension

Existing file or directory destinations reject; each save stages all pages, publishes exclusive new destinations and removes its own staged/published outputs on failure

The filesystem must support the native exclusive staging and link publication operations; separate PDF, SVG and PNG saves are separate operations, and do not form a combined transaction

Standalone Linux consumer

Tests/Portable/RenderPortableSnapshot.pas is a complete consumer that loads a snapshot, prepares one layout and saves all three formats; build it on Linux with the portable units and native libraries installed

fpc -Mdelphiunicode -Fu/path/to/HotXLS/Lib RenderPortableSnapshot.pas
./RenderPortableSnapshot report.hxrs /srv/output/report fonts.tsv 595 842 96

fonts.tsv is UTF-8 text with four tab-separated fields per mapping: family alias, absolute Linux font path, face index and one of regular, bold, italic or bolditalic

Calibri	/srv/fonts/Regular.ttf	0	regular
Calibri	/srv/fonts/Bold.ttf	0	bold
Calibri	/srv/fonts/Italic.ttf	0	italic
Calibri	/srv/fonts/BoldItalic.ttf	0	bolditalic

Use actual installed or application-supplied font files, and choose a new output base because existing destination files are rejected; include additional same-style fallbacks for scripts not covered by the first mapping

Stream := TFileStream.Create('report.hxrs', fmOpenRead or fmShareDenyWrite);
try
  Snapshot := LoadXLSPortableRenderSnapshot(Stream,
    XLSDefaultPortableRenderLimits);
finally
  Stream.Free;
end;
Options := XLSDefaultPortableCairoOptions;
Layout := PrepareXLSPortableCairoLayout(Snapshot, Fonts, Options);
try
  Files := Layout.Save('/srv/output/report.pdf', xpcfPDF);
  Files := Layout.Save('/srv/output/report.svg', xpcfSVG);
  Files := Layout.Save('/srv/output/report.png', xpcfPNG);
finally
  Layout.Free;
end;

Cached chart recording

XLSRecordCachedChartScene in lxPagination records the existing chart layout renderer's point-based primitives into an immutable portable scene representation; its source must be a detached TXLSXChart with no owning worksheet and no preserved native XML, so recording cannot resolve worksheet references or refresh workbook caches

The current subset supports column, bar, line, scatter, pie, doughnut, and ordinary single-series area charts with one primary plot group, finite numeric value caches, and strictly increasing bounded cache indices; scatter category caches contain numeric X coordinates, while the other families use stored category labels

Column, bar, line, and area value caches must have contiguous zero-based indices; sparse category value gaps reject, and recording never expands missing indices into a large array

Bar plots retain horizontal geometry and categorical labels; pie and doughnut plots use category legends, honor FirstSliceAng and HoleSize, and omit numeric axes, while ordinary single-series area plots retain a filled polygon around the zero baseline

Line and scatter series support independent line visibility, explicit RGB color and point width through LineVisible, LineColorRGB, and LineWidthPoints; LineStyleSet, LineColorSet, and LineWidthSet distinguish explicit settings from inherited defaults, and EffectiveLineVisible resolves the existing fill-only series convention

Markers support the automatic circle, an explicit circle, or no marker; an explicit MarkerSize from 2 through 72 sets its point diameter, and MarkerFillSet and MarkerBorderSet distinguish an explicit black RGB value of zero from automatic color selection; connecting segments are painted before opaque data markers

Explicit marker borders without a stored width use the ordinary 0.75-point line, while legend samples cap circle diameter at 6 points; requested title fonts are written on the actual rich-text run as well as its default text properties, retaining their visible size, color, and emphasis when Excel exports the chart

Unsupported chart families, stacked or multiple-series area plots, multiple-series circular plots, gallery styles, rounded corners, secondary or combined plot groups, date axes, custom number formats, logarithmic axes, custom crossing behavior, rotated text, trendlines, error bars, hierarchical categories, data labels, other marker shapes, and missing value caches raise EXLSPortableRender before rendering

Custom value-axis tick fonts, minor grids, explicit major/minor units, invalid explicit series colors and unsupported axis positions reject; bar legends currently require the ordinary right-hand placement, and circular plots require a finite nonzero cached total and bounded geometry with an early conservative reservation for arc scratch storage

The returned array retains primitive drawing order, explicit colors, fonts, text alignment, opacity, and chart clipping bounds; item, byte, and text accounting includes conservative renderer scratch reservations, and cooperative cache checks precede scratch array allocation

XLSValidateCachedChartSceneModel performs the same bounded cache and appearance preflight on a model without resolving worksheet cells; the XLSX capture bridge uses this check before cloning and records supported authored chart models with local one-dimensional A1 references, physical native anchor offsets, range clipping, and drawing order

The platform-neutral recorder lives in lxPortableChart; the existing lxPagination entry points share the same layout and primitive recording bodies, retaining the Windows renderer's behavior and matching immutable scene bytes and budget accounting for each supported family

Native Linux and macOS Workbook capture uses the explicit geometry overload described below; imported series RGB fill, plot-area background, chart background, and chart border are recovered from their own namespace-resolved shape properties so a nested series color cannot overwrite the plot background

Imported preserved ChartML is accepted only when its namespace-expanded element, attribute, and significant-text stream matches the supported typed reconstruction; namespace aliases and attribute order normalize, while unmodeled native extensions, foreign attributes and unsupported appearance reject conservatively

Raw XML and reconstruction scratch budgets are checked before cloning and projection work; only the detached copy clears its validated preserved XML, and the source retains native metadata, cell storage, cache contents, and generation

Capture walks underlying OfficeArt drawing order, including chart frames absent from the public Shapes wrapper, and rejects an intersecting unsupported frame instead of silently omitting it

Classic cached charts with declared appearance

Classic BIFF8 capture supports the seven ordinary chart families above when their core records, local stored values, explicit linear scales and appearance are representable; it reads retained records and available formula caches without evaluating formulas, expanding sparse storage or cloning compiled formula trees

Use TXLSWorkbook.CreateReadOnlyViewWithChartAppearance(Source, Limits, Geometry) to create a separate read-only view with a frozen set of TXLSClassicChartAppearanceDeclaration values supplied by IXLSClassicChartAppearanceSource; Geometry is optional on Windows and supplies explicit native font measurements on Linux or macOS

TXLSClassicChartAppearanceDeclarations is the dynamic array of primitive declarations an application may use to implement that source

Pass that configured view to CaptureXLSPortableViewRenderSnapshot(View, SheetIndex, Row1, Col1, Row2, Col2, Limits); coordinates are one-based and the adapter restores the caller's active worksheet when capture finishes or rejects

The ordinary capture entry points continue to reject unresolved effective Classic layout or legend fonts; the distinct view entry point uses the already frozen declarations and geometry provider

Declaration memberContract
Generation, SheetIndex, ObjectIdThe pinned workbook generation, one-based worksheet index and actual stored chart object identity; stale generations, missing or repeated identities and identities belonging to another object reject
HasChartSize, ChartWidthPoints, ChartHeightPointsAn explicit finite positive chart-frame size in points; it retains the stored anchor origin and drawing order, while a false flag keeps the anchor-derived dimensions
HasPlotInnerRectangle, PlotInnerRectangleAn explicit inner plotting rectangle excluding labels and axis titles; it is required for this declared appearance path
HasTitleRectangle, TitleRectangleAn explicit title rectangle when the chart has a title; source text, font family, emphasis and color still come from validated core records
HasLegendRectangle, LegendRectangleThe declared legend bounds when a legend is present
HasLegendFontSize, LegendFontSizePointsThe caller's explicit effective point size for a present legend; core font family, emphasis and color are retained
TXLSPortableChartRectangleLeft, Top, Width and Height are finite points relative to the captured chart frame; active rectangles require positive dimensions within that frame
Count, GetCount, ReadDeclarationThe source reports a bounded count and returns one primitive record for each zero-based index while the view is configured; declarations are copied before later capture

These values are caller-declared appearance, not automatic Excel layout or inferred font scaling; obtain them from an independently checked source or an application-defined layout and review the output with the explicit native font mapping used for rendering

Explicit frame dimensions and inner plotting bounds must leave enough room for the validated axis-label fonts; insufficient label space rejects instead of clipping text or applying a fitted scale factor

Applications keep the workbook owner alive until the view is released; the borrowed view holds a read lease and retains the declaration source, while the resulting immutable snapshot retains neither the workbook nor the provider

Supported core projection includes literal solid fills, visible solid lines, circle markers, title and legend text, category placement and bounded explicit numeric ticks; automatic scales, unresolved automatic marker appearance, smoothing, unknown rich extensions, foreign or nonlinear series references and unrepresented point styles reject before output

Declaring geometry or a legend size does not authorize ignoring unknown chart extensions or unvalidated styles; byte, text, stored-cell and scene limits remain effective for retained source data, declarations, detached caches and recording scratch space

The additional XLSValidateCachedChartSceneModel and XLSRecordCachedChartScene overloads accept TXLSCachedChartSceneAppearance for a detached model; initialize it with XLSDefaultCachedChartSceneAppearance before setting explicit controls

The lower-level XLSReadClassicChartScene in lxClassicChartScene returns a caller-owned detached TXLSXChart and primitive appearance and budget counters from a retained TXLSCustomChart, its exact source calculator and a leased TXLSClassicChartSceneSource; free the returned model after recording

TXLSClassicChartSceneSource.ReadAppearance supplies a primitive declaration, ReadCell reads bounded pinned local stored values, ReadFont fills the supplied text style with bounded effective core font data, and PaletteColor resolves explicit stored palette entries; application implementations must preserve the pinned source and honor every supplied byte and character quota

Scene appearance memberMeaning
SeriesMarkerSizePointsBounded per-series point diameters, including fractional values; zero keeps the model's marker size and a nonzero override must be from 2 through 72 points
OverrideBorder, BorderColorRGB, BorderWidthPointsExplicit chart-frame outline appearance
AxisColorRGB, TickColorRGB, GridlineColorRGB, AxisWidthPoints, TickWidthPoints, GridlineWidthPointsExplicit axis, tick and major-grid paints and point widths
AreaFillOpacity, SeriesFillAlphaArea opacity and series fill alpha
UseAxisTickControls, CategoryBetweenValidated explicit axis controls and categorical placement
TitleOffsetXPoints, TitleOffsetYPointsFinite offsets applied to the recorder's ordinary title position
OverridePlotInnerRectangle, OverrideTitleRectangle, OverrideLegendRectangle, PlotInnerRectangle, TitleRectangle, LegendRectangleLiteral point rectangles relative to the chart frame
PieRadiusRatioCircular-plot radius as a bounded fraction of the smaller plot dimension

Chart primitives follow HotXLS's existing layout policy; chart gallery appearance that requires Excel's unmodeled defaults remains an explicit unsupported boundary

Direct native workbook capture

CreateXLSPortableCairoRenderGeometry(Fonts, Calibration, Generation, Backend, Options, CacheCapacity) returns an IXLSRenderGeometry backed by the same explicit font files, FreeType, HarfBuzz and text shaping used for native output; column widths use actual measured maximum-digit width with the workbook calibration

The provider owns detached font bytes and a bounded metric cache, checks font and layout budgets before allocation, and validates measurement requests before changing cached state; a full cache can return uncached measurements without expanding beyond its capacity

Capture verifies that the provider generation and all calibration fields match the current read-only workbook view, retains the provider for that view, and leaves the workbook's default geometry factory unchanged; ordinary default native geometry remains an explicit GDI boundary

Capture the generation through an explicitly released view before creating the provider; retaining a temporary interface result can retain its read lease until the surrounding scope ends

View := Owner.CreateReadOnlyView;
Generation := View.Generation;
View := nil;
Geometry := CreateXLSPortableCairoRenderGeometry(Fonts,
  Workbook.CaptureRenderCalibration, Generation, xlsrgbBitmap,
  XLSDefaultPortableCairoOptions, 4096);
Snapshot := CaptureXLSPortableRenderSnapshot(Owner, 1, 1, 1, 30, 6,
  XLSDefaultPortableRenderLimits, Geometry);

Native consumers compile with LX_PORTABLE_CORE and the corresponding native dependencies; Windows calls to the native Cairo geometry factory reject explicitly, while Windows capture can use its existing geometry factory through the same scoped overloads

Actual native capture supports the modeled scalar, rich-text, supported raster, ordinary shape, and seven cached chart families described above; chart capture preserves the original imported ChartML, cached points, sparse cell storage, packed storage, and Workbook generation

For immutable print areas, margins, fit or percentage scaling, repeated titles, manual breaks, and whole-cell or merged-cell pagination, see portable print plans

Advanced capture bridge

IXLSRenderCaptureSource in lxSemanticSnapshot is the internal coordination interface implemented by supported read-only workbook views; ordinary applications should call the owner-based capture overloads

TXLSClassicReadOnlyWorkbookView and TXLSXReadOnlyWorkbookView implement IXLSRenderCaptureSource, including the eight render methods below; these classes coordinate capture through read-only views, and the adapter manages their lifetime while applications retain their workbook owner interface and call CaptureXLSPortableRenderSnapshot

Their existing TryReadCell method supplies a stored-cell snapshot through the read-only view; the render methods add detached appearance and geometry for portable capture

Member or helperPurpose
ValidateRenderRangeChecks one-based rectangle bounds and unsupported appearance footprints before capture
ReadRenderStyleReturns detached TXLSSemanticCellStyle metadata and a rich-text presence flag for a one-based cell
IXLSRenderRichTextCaptureSource, ReadRenderRichTextOptional view extension returning bounded detached TXLSRenderTextRuns; each TXLSRenderTextRun contains Text and an effective semantic Style, using the supplied base style and positive run/byte quotas without materializing cells or modifying style pools
RenderRowHeightPoints, RenderColumnWidthPointsReturn physical geometry, collapsing hidden dimensions to zero
IXLSRenderGeometryCaptureSource, SetRenderCaptureGeometryOptional view extension retaining an explicit provider only after generation and calibration validation; invalid providers leave the retained view provider unchanged
ReadRenderMergeReports the complete inclusive one-based merge rectangle containing a cell
ResolveRenderColorResolves semantic theme/indexed/RGB appearance to a portable RGB color, using the supplied default where supported
RenderDate1904, RenderRightToLeftExpose workbook date-system and sheet reading-order context
XLSRenderCaptureLiteralRecognizes the supported literal Boolean, finite number or simple quoted text subset for capture without evaluation
XLSRenderCaptureIntersectsTests whitespace-separated local A1 ranges against a one-based rectangle, rejecting unresolved range syntax
XLSRenderCaptureConditionEvaluates the supported condition subset against an existing scalar; comparison operator codes 1 through 8 mean between, not-between, equal, not-equal, greater, less, greater-or-equal and less-or-equal
XLSRenderCaptureApplyDxfApplies supported detached differential appearance using an AppliedSlots mask to retain higher-priority formatting
TXLSDxfStyle._MarkRenderUnsupportedAppearance, TXLSDxfStyle._HasRenderUnsupportedAppearanceInternal-prefixed import coordination methods record and inspect appearance that the typed differential model cannot render safely; Assign retains the marker, and capture rejects a marked matching style

These bridge helpers can raise EXLSSemanticSnapshot; the public capture adapter translates that exception to EXLSPortableRender