HotXLS documentation / API reference

Portable print plans

Keep logical pagination separate from native output: lxPortablePrint builds an immutable print plan from a detached render snapshot, and lxPortableCairo draws its pages as PDF, SVG or PNG on Linux and macOS

The planner works in physical points and complete cell boundaries, preserves merged ranges, repeats row and column titles, and applies disjoint print areas, manual breaks, orientation, margins, centring, scaling and page order without changing the source workbook

Use workbook page setup

CreateXLSPortableWorkbookPrintPlan in lxPortableWorkbookPrint comes with overloads for a borrowed TXLSWorkbook and TXLSXWorkbook; both take SheetIndex, OriginRow, OriginColumn, Snapshot and Defaults

The sheet index and snapshot origin are one-based; the adapter insists on a snapshot from the current workbook generation and a captured rectangle taking in every complete print area and repeated title range

Snapshot identity takes in its generation, whilst the caller supplies the matching sheet and origin; keep the correct sheet context when transporting a snapshot, because the snapshot format encodes neither a workbook nor a worksheet identity

Snapshot := CaptureXLSPortableRenderSnapshot(Owner, 1, 1, 1, 30, 6,
  XLSDefaultPortableRenderLimits, Geometry);
Plan := CreateXLSPortableWorkbookPrintPlan(Workbook, 1, 1, 1,
  Snapshot, XLSDefaultPortablePrintOptions);
Layout := PrepareXLSPortableCairoLayout(Plan, Fonts,
  XLSDefaultPortableCairoOptions);
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;

Use the explicit font-backed geometry provider described in direct native workbook capture when capturing on Linux or macOS; pagination itself needs neither Cairo, font files, Excel nor a printer driver

The workbook adapter takes a temporary read lease, reads the existing metadata and hands back detached data; it neither adopts a raw workbook through an owning interface nor keeps a workbook lease in the result

Quoted sheet names, escaped quotes and comma-separated print areas are accepted for the selected worksheet only; references outside the captured rectangle, foreign sheet references, incomplete title ranges and malformed ranges are refused explicitly

Recognised paper sizes are Letter, Tabloid, Ledger, Legal, A3, A4, A5, B4 and B5; an unspecified paper size falls back on Defaults.PageWidthPoints and Defaults.PageHeightPoints, whilst an unrecognised explicit paper size is refused

The adapter carries supported header and footer content, row and column headings, enabled print gridlines, black-and-white and draft appearance, at-end comment listings, and typed cell-error substitutions over into the detached plan

Supported visible comment boxes use their source anchors and a separate page annotation layer, taking in notes whose boxes reach outside the printed cell range

Headers and footers

The planner places left, centre and right sections in the physical header and footer margins, including distinct first-page and even-page content, page numbers and total page counts, document names, escaped ampersands, font faces, point sizes, colours, emphasis, underline, double underline, strikeout, superscript and subscript

ScaleHeaderFooterWithDocument and AlignHeaderFooterWithMargins follow the worksheet page setup; repeated worksheet pages and appended comment pages share the final page-number sequence

Set HeaderFooterDateText and HeaderFooterTimeText to the intended deterministic display strings for the date and time fields; the detached planner never reads the system clock whilst constructing each page

Theme colours use HeaderFooterThemeColors when HasHeaderFooterThemeColors is enabled; the modern workbook adapter reads that palette in from the source workbook

Theme-font tokens can take explicit HeaderFooterThemeMajorFont and HeaderFooterThemeMinorFont mappings; set HeaderFooterThemeScript when the modern workbook adapter should resolve a particular supplemental script out of the source theme

Supported source PNG and JPEG header pictures are captured with their source page kind, section, size, crop and offsets; drawing keeps the picture's inline position relative to adjacent text, and later picture tokens in the same section do not duplicate the image

Classic source picture records are read without changing the workbook, including available page variants; malformed records, missing picture data and unsupported appearance reject before a plan is returned

Headers paint before worksheet body cells and drawings, whilst footers paint after them; supported text and images can overlap worksheet content or reach beyond physical page boundaries

The planner retains the original logical geometry and clips visible output to the physical page instead of shifting the source object to fit its margin

For plain text longer than one page, the renderer keeps the initial page-sized sequence of actual shaped lines before bottom-aligning a footer; the full source text and shaping work stay charged to the resource limits

TXLSPortablePrintPage.HeaderObjectCount identifies the leading header entries in HeaderFooterObjects; the remaining entries belong to the footer phase

The count must lie between zero and the object-array length inclusive; zero keeps all entries after the body for a caller-supplied page without an explicit header boundary, and invalid counts reject before header/footer decoration allocation

Classic picture anchors store pixel dimensions; point dimensions are obtained as pixels multiplied by 72 and divided by Workbook.RenderCalibration.MeasurementDpi, whose existing default is 96

Configure the intended measurement context explicitly when source interpretation calls for another DPI; the library does not infer an absent source-machine DPI field

A matching explicit HeaderFooterPictures declaration continues to override dimensions, offsets and raster sampling, whilst invalid declarations keep their validation errors

The focused controls cover 96 DPI and 120 DPI contexts, explicit overrides, crop fractions, multi-record Classic PNG data, ordinary overlap and extreme plain-text or image clipping

Mixed text and pictures support physical-page clipping and the source-preserving flow policy below; unknown picture effects, implicit recipient font/locale equivalence and pixel-identical print mapping stay separate boundaries

Measured recipient geometry for pictures

TXLSPortablePrintOptions.HeaderFooterRecipientMetrics captures a TXLSPortableHeaderRecipientMetrics value record; initialise options with XLSDefaultPortablePrintOptions and switch on the measured context only when the intended source and recipient metrics are available

The default is disabled and keeps source point geometry; no process printer, screen scaling, image metadata DPI or native export device is guessed at

FieldContract
EnabledEnables the explicit source/recipient mapping
QuantizeToRecipientPixelsRounds final extents and offsets to recipient pixels after document scaling; an image rounding to an empty extent rejects
SourceDpi, RecipientDpiInteger36..2400 for the corresponding measurement context
SourceMaximumDigitWidthPixelsMaximum advance of the digits0..9 in the source-context workbook Normal font, measured in source pixels
RecipientMaximumDigitWidthPixelsCorresponding Normal-font maximum digit advance in recipient pixels
SourceNormalLineHeightPointsActual default Normal line box in source points, not a custom worksheet row height
RecipientNormalLineHeightPixelsComplete Normal line box in recipient pixels, including that context's line spacing and its padding

The four floating-point metrics must be finite and within1/64..1000000; measure the same intended Normal font in each context and keep each pixel measurement alongside its matching DPI

WidthScale = RecipientMaximumDigitWidthPixels / SourceMaximumDigitWidthPixels
             * SourceDpi / RecipientDpi
HeightScale = RecipientNormalLineHeightPixels * 72 / RecipientDpi
              / SourceNormalLineHeightPoints
Width = SourceWidthPoints * DocumentScale * WidthScale
Height = SourceHeightPoints * DocumentScale * HeightScale
LeftOffset = SourceLeftOffsetPoints * DocumentScale * WidthScale
TopOffset = SourceTopOffsetPoints * DocumentScale * HeightScale
QuantizedPoints = floor(Points * RecipientDpi / 72 + 0.5) * 72 / RecipientDpi

Quantisation follows the existing document scale, and the final extents and offsets must stay within the one-million-point geometry bound even after pixel rounding; no fixed scaling coefficient or guessed line padding is inserted

The measured context applies consistently to the selected odd/even/first header and footer pictures; it preserves source image bytes, crop fractions, physical page margins, source text, paint phases and clipping, whilst the effective picture width participates in mixed flow

Options are copied by value and result scene getters detach their arrays; fixed context storage and validation/mapping work stay charged to the existing plan budgets without holding on to device handles or callbacks

An ordinary render snapshot of HeaderFooterObjects preserves mapped base scene geometry; it does not keep the complete PrintPlan, inline link metadata or later inline-layout adjustments, and this change adds no snapshot format version

Five independently measured Normal-font contexts qualify pure-image dimensions; marker-font spacing and the optional measured text context below also deal with mixed image/text advance and line progression

Measured inline segment spacing

When the explicit recipient context is enabled, each TXLSPortableHeaderInlinePicture captures the font active at its supported &G marker, including font changes that emit no text

FieldContract
RecipientDpiZero disables measured spacing; an enabled captured DPI is within36..2400
MarkerFontFamilyRequired nonempty marker family when enabled, at most255 UTF-16 code units; the returned link array comes back detached
MarkerFontSizePointsFinite effective point size after document scaling, within1/64..4096
MarkerFontStylesCaptured style set; bold and italic pick the corresponding explicitly supplied face

Inactive links require empty or zero font fields; initialise records before use and rebuild dependent code for the expanded public record layout

The renderer resolves the marker family by way of the explicit family/style fallback chain and reads only the required two-byte OS/2.xAvgCharWidth and head.unitsPerEm fields from the selected SFNT or collection face

fontPixels = floor(markerPointSize * recipientDpi / 72 + 0.5)
averagePixels = floor(fontPixels * xAvgCharWidth / unitsPerEm + 0.5)
segmentPaddingPoints = floor(averagePixels / 4) * 72 / recipientDpi

The marker point size already includes document scaling; this spacing is independent of the Normal-font width ratio used for base image geometry, and no native PDF dimensions or per-picture target offsets serve as metric inputs

A prefix in the current hard paragraph contributes one image allowance even when it has moved to an earlier soft line; a suffix contributes to the image-line measure when there is no paragraph prefix or that prefix sits on the image line

The suffix allowance expands the image only when both text segments share the image line; otherwise it stays a logical gap, hard breaks reset the paragraph state and colour-run boundaries do not multiply the allowance

Zero-width source characters remain nonempty segments; trailing ASCII spaces remain in the captured source though they add no suffix allowance or final measured advance

Invalid link fields, unavailable SFNT metrics, nonpositive average width and invalid units-per-em reject; explicit font coverage, font-byte limits, cancellation and the existing shaping/layout limits remain in force

Family strings and link arrays stay charged during validation and copying; measuring a suffix without its trailing-space advance reserves the complete original shaped result until the temporary measurement is released

Twenty-eight native controls qualify image extents across the represented font, marker and adjacency cases; reconstructed SFNT averages do not establish GDI-metric equivalence for every font

With the text context disabled, this SFNT path keeps its earlier point-layout behaviour; enable the measured text context below when the intended recipient provides compatible font metrics and cumulative advances

Measured recipient text and mixed line progression

TXLSPortablePrintOptions.HeaderFooterRecipientTextContext accepts an optional TXLSPortableHeaderRecipientTextContext with Geometry, ExtraLeadingPixels and Cancellation; initialise options with XLSDefaultPortablePrintOptions before enabling it

Geometry must implement the optional IXLSRenderFontMetricSource companion and carry the captured snapshot generation; the original IXLSRenderGeometry GUID and method order are unchanged

Use a valid calibration between36 and2400 DPI, matching the image recipient DPI when image mapping is enabled; measure additional leading independently as complete Normal line height minus Normal font height and external leading, instead of assuming a fixed DPI or padding constant

ExtraLeadingPixels is finite and within0..1000000; a disabled context carries nil Geometry, zero extra leading and nil Cancellation, and generation or calibration mutation during capture rejects

Bounded font metric companion

The Windows geometry implements MeasureFontMetrics(AFont) and MeasureTextAdvances(AText, AFont, AMaximumBytes, AAdvances) under its existing lock with actual selected-font measurements; another planning process can implement the same explicit companion

TXLSRenderFontMetrics contains integer HeightPixels, AscentPixels, DescentPixels, EmHeightPixels, ExternalLeadingPixels and AverageWidthPixels; ordinary width/height corrections apply to measured extents whilst the selected em remains the actual pixel em

TXLSRenderTextAdvances holds detached cumulative integer advances, one per UTF-16 unit; the final advance equals the returned TXLSRenderTextMetrics.WidthPixels, and no returned mutable array is retained by the provider

Advance requests take at most32767 normalised single-line UTF-16 units, validate surrogate pairs and reject control characters; array storage is checked against AMaximumBytes before allocation, and empty text returns zero metrics and no array

Requested font families are nonempty, hold no control characters and use at most255 UTF-16 units; point sizes are finite within1/64..4096, and Windows selected-font substitution rejects rather than measuring another family

Detached capture and native layout

TXLSPortablePrintPage.HeaderRecipientTexts holds at most six uniquely indexed TXLSPortableHeaderRecipientText values with TextObjectIndex, RecipientDpi, ExtraLeadingPixels, NormalizedText, Runs, HasMarker and MarkerMetrics

Each TXLSPortableHeaderRecipientTextRun preserves one-based normalised UTF-16 SourceStart and SourceLength, source FontFamily, FontSizePoints, FontStyles, measured Metrics and cumulative Advances; intervals are contiguous and cover the complete normalized text

TXLSPortableHeaderRecipientTextRuns and TXLSPortableHeaderRecipientTexts are the matching array types; page getters deep-copy nested run and advance arrays, and a completed plan retains no live geometry provider

The renderer checks text, source intervals, font identity, marker association, DPI and cumulative values before holding its own detached data; selected pixel em and logical Unicode-cluster advances drive font size, wrapping and placement

Measured ascent, descent, external leading and additional leading drive multiline text; mixed lines distinguish adjacent text, image-only soft wraps and hard breaks, whilst footer progression derives from its bottom anchor

Small images align with adjacent text, large images can lift the text pen, and the first residual suffix reserves the independent logical image allowance; source text, header/body/footer paint order and final physical-page clipping stay intact

Font files and their fallback chain remain explicit renderer inputs; the measured path rejects falling back to an unmeasured family, whilst nil Geometry keeps the earlier point-layout path

Capture work and array/string reservations share MaxPlanningSteps and MaxPlanBytes; renderer temporary and retained copies share MaxLayoutBytes, with the existing cancellation, shaping, glyph, line, draw and output limits still enforced

Rebuild consumers for the expanded option/page record layouts; the ordinary render-snapshot format stays unchanged and does not serialise a complete print plan or its recipient metrics

Twenty-five actual workbook outputs cover left/centre/right sections, text and mixed footers, style and marker changes, hard/soft wraps and independent12/96-point image-height controls; every source character and all25 body labels remain present

In that retained comparison, baseline differences are at most0.024 pt, image placement at most0.12 pt and comparable glyph origins approximately0.309113 pt; logical measurements promise nothing about identical internal PDF glyph emission

Two oversize native controls discard a source character that the portable renderer keeps; repeated-page, page/date token and document-scaling behaviour keep their previously qualified contracts

Mixed text and picture flow

Mixed paragraphs keep fitting text and picture segments on the same line; the picture shares a line with preceding text when both fit, and following text stays beside it when the complete following segment fits the remaining line width

If the following segment needs wrapping, it starts on the next line using the section width minus the effective picture advance and any independent segment allowance, then carries on with the complete section width; left, centre and right alignment apply within each line's available width

A remaining width that cannot hold one complete supported Unicode cluster resumes at full section width, hanging on to the cluster instead of dropping a character

Text flow preserves source characters and style offsets, breaks at supported Unicode shaping-cluster boundaries and prefers existing word spaces where it can

The picture remains an atomic item with source point dimensions unless an explicit measured recipient context is switched on; a picture wider than the physical page is aligned normally and clipped without shrinking its source geometry

Wrapped text uses the physical-page clip rather than the original explicit-line-count rectangle, so newly wrapped prefixes and suffixes stay visible within the page

For content taller than one page, the renderer keeps the initial page-sized sequence of shaped source lines before footer alignment; a picture belonging only to a discarded line gets an empty visible clip

Every source line and glyph is prepared and charged before this page-prefix selection, and temporary arrays for the complete paragraph stay charged throughout shaping and line insertion even when only a small prefix is visible

The remaining-width rule follows the observed native flow pattern whilst retaining complete captured source text and explicit point geometry; the original source holds on to its30 A /21 Z /9 Z line division, and the optional text context supplies measured advances and vertical progression

Prepared GetTextLine inventory is limited by the existing physical-page height: source objects stay complete, but wholly page-external line records can be clipped; it is not an inventory of every character in an arbitrarily long source header

Print decorations and error policies

PrintGridlines and PrintHeadings add page-specific grid and heading geometry without touching cell formats; repeated title rows and columns retain the matching labels

BlackAndWhite applies the print projection to detached text, borders, scene objects and decoded raster pixel data; Draft leaves out the supported drawing and fill appearance according to the print policy

PrintErrors selects displayed errors, blank output, a dash or #N/A through xppeDisplayed, xppeBlank, xppeDash and xppeNA; substitutions use captured error identities and leave ordinary text that merely resembles an error unchanged

Comments at the end of a worksheet

The normal workbook entry captures source comment text and cell addresses under its read lease, selects the comments associated with the print areas, sorts the listing by cell address, and avoids duplicates when areas overlap

The listing uses source font zero, including its resolved theme face, point size, emphasis and colour; original comment-box rich formatting does not take over the listing font

AtEndFontOverride defaults to False; enable it only when deliberately replacing the source listing font with AtEndFont

AtEndLanguageTag and AtEndThemeScript select an explicit language or supplemental script context; an empty language context falls back to the Windows user interface language or the Unix locale environment, with source-font hints for a neutral locale

The source defaultThemeVersion participates in resolving the observed default font and colour profiles; other version values keep the source theme rather than inheriting a guessed profile

When AtEndMeasurer is absent, the adapter creates a default text-measurement context: native GDI on Windows, or Cairo and its font providers on the supported Unix targets

Unix system-font discovery checks bounded known font locations and can pick the installed platform equivalent for a common Latin family; unavailable families report the missing resource, and AtEndFontFile with AtEndFontFaceIndex supplies an explicit font file or collection face

A supplied measurer must match the snapshot generation; detached line layouts hold the native font resources required for later rendering, whilst the finished plan does not retain the source workbook read lease

The listing preserves complete source text, wraps measured lines, and adds pages as needed instead of silently truncating long notes; AtEndCellLabel, AtEndCommentLabel, AtEndLabelWidthPoints and AtEndNoteGapPoints customise its labels and spacing

Source capture and line measurement share the plan's byte and work limits, and AtEndCancellation allows bounded cancellation during capture and planning

TXLSPortablePrintPage.Kind distinguishes xppkWorksheet and xppkCommentsAtEnd; listing pages expose retained measured TextSlices, whilst worksheet pages keep their ordinary body tiles

Displayed comment boxes and at-end listings follow separate print policies; choosing one policy does not inject the other into the plan

Supported multiline headers and footers, including the mixed-content policy above, retain header/body/footer paint priority and physical-page clipping; implicit recipient font and locale parity stay separate qualification boundaries

Displayed comment boxes

The normal XLS and XLSX workbook entries capture supported visible rectangular note boxes from their actual source anchors, including source fill and outline colours, stroke width, text insets, rich font runs, text alignment and a cell-to-box leader

A note belongs to a printed page through its associated cell, not through an intersection between its box and the printed cell range; its box can extend outside the body tile and is clipped to the physical page

Repeated title tiles can repeat notes associated with those cells, draft mode suppresses displayed notes, and monochrome worksheet printing keeps the displayed note colours observed in native output

Imported source visibility is respected, whilst explicitly assigning the public comment visibility property overrides that visibility for capture; copying or editing general VML geometry remains a separate source-model operation

DisplayedCommentGeometry supplies an optional IXLSRenderGeometry for source anchors outside the detached body range; rows and columns inside the supplied body snapshot use that snapshot's own explicit dimensions

DisplayedCommentCancellation allows cancellation during capture and planning; byte, character, item and work costs share the existing plan limits, and callbacks must keep the workbook and active worksheet context

IXLSPortableDisplayedCommentSource.ReadPortableDisplayedCommentObjects accepts a one-based source range, an optional matching BodySnapshot, TXLSPortableRenderLimits, MaxSteps and cancellation, and reports UsedBytes, UsedCharacters, UsedSteps and UsedItems

The matching body snapshot must have the source generation and exact range dimensions; source capture holds a read lease, rejects reentrancy and context changes, and gives back detached data

TXLSPortableDisplayedCommentObjects is an array of TXLSPortableDisplayedCommentObject records with a one-based Row, Column and Drawing; drawing coordinates are in points relative to the source range origin

Direct CreateXLSPortablePrintPlan callers can provide these records through DisplayedCommentObjects; text, rectangle, polyline and polygon objects are supported, whilst image payloads on these annotation objects are rejected

The normal workbook entries wipe supplied annotation records and capture the actual workbook source; finished page records expose owned CommentObjects, with independent path and rich-text arrays on retrieval

The completed plan retains no source workbook lease, and its supported annotations can be rendered after the workbook owner has been released

Unknown note appearance, missing source anchors, conflicting or unsupported colour identities and unmodeled shape effects fail explicitly; ordinary worksheet drawings keep their existing capture requirements, and displayed-note support does not imply whole-sheet drawing capture

XLSX comment rich text resolves theme and RGB colours with tint, indexed palette colours, automatic colours and supported system foreground/background roles; colour identities and validated tint tokens survive saving and rich-text assignment

Native comment rendering applies tint to theme and RGB selectors; indexed, automatic, empty-colour and tint-only selectors retain their tint token whilst rendering the observed untinted colour

Explicit colour edits replace the old source identity, including a tint attached to the same RGB value; bold, italic and strikeout take the standard XMLBoolean forms 1, 0, true and false

Out-of-range notes do not require anchors during capture; selected visible imported notes require supported retained geometry, whilst newly authored OOXML notes use the known defaults described below

The focused native profile compares presence, text, colours and fonts in actual XLS and XLSX WorkbookPrint-to-Cairo PDF output, with explicit source geometry; it does not assert pixel-identical recipient font metrics or automatic native geometry equivalence

Newly authored OOXML comments

Newly created OOXML comments support displayed-comment printing before saving and after saving plus reopening, with the known default appearance shared by the writer

The default box starts 80 pt from the worksheet left edge and 5 pt from the top, with a width of 96 pt and a height of 55 pt; positive explicit WidthPt and HeightPt replace those dimensions

This absolute default position does not chase the source cell or avoid other notes; notes attached to distant cells still use the same box origin

AlwaysShow governs displayed-comment visibility and newly written VML visibility; hidden comments add no displayed-comment layer

The supported default appearance takes in a pale yellow frame, black shadow offset by 2 pt, source-cell leader and printed text insets of 1.8 pt horizontally and 3.6 pt vertically

Adding typed comments to a sheet with retained comment VML keeps the existing shapes and appends namespace-self-contained shapes with unused IDs

Imported comments require supported retained geometry or the recognised writer-generated no-anchor profile; missing VML, foreign default positions and duplicate CSS properties fail explicitly rather than picking up authored defaults

Range copies retain authored provenance, whilst OOXML and ODS imports do not acquire it automatically; this entry does not change arbitrary imported VML edits, unrelated form controls or automatic layout

The focused final-source qualification covers actual body capture and WorkbookPrint-to-Cairo PDF output on Linux; existing RAD Studio 37.0 Win64 controls cover metadata, source capture, print planning and the writer XML

Newly authored Classic XLS comments

Newly created visible Classic XLS comments support displayed printing before saving, after saving plus reopening, and after changing their public width or height

The existing Classic model defaults remain 96 by 55.5 points; capture derives a local anchor from the writer's source-cell-relative placement, stored row and column sizes, hidden axes, edge fallbacks and anchor quantisation

Source capture does not materialise or modify the authored comment's source anchor; the detached drawing maps the derived fractions through the caller's explicit body geometry

The ordinary enabled black shadow has a two-point offset and requires an explicit black source colour; unknown system or missing enabled-shadow colours retain an appearance diagnostic

Displayed notes accept the writer's exact-cell-end fractions of 1024 horizontally and 256 vertically; ordinary worksheet drawing bounds stay unchanged

Classic range copies use the existing destination AddComment path and therefore create a fresh default comment shape; copying raw source anchors or appearance is a separate operation

Imported comments do not acquire authored provenance; a selected visible imported note with unavailable geometry now raises explicitly instead of quietly disappearing

The final focused controls cover source and print-plan behaviour with existing RAD Studio 37.0 Win64, and actual WorkbookPrint-to-Cairo PDF output on Linux; native Excel controls qualify ordinary visibility, source-relative placement and black shadow appearance

Native Excel interprets quantised source anchors through its own calibration; identical pixel positions, pagination, grid appearance and text wrapping are not promised

Source and measurement interfaces

IXLSPortableAtEndCommentSource exposes ReadPortableAtEndComments and ReadPortablePrintFontZero; TXLSClassicReadOnlyWorkbookView and TXLSXReadOnlyWorkbookView implement these methods without transferring workbook ownership or altering source formatting

ReadPortableAtEndComments returns detached TXLSPortablePrintComments, an array of TXLSPortablePrintComment records containing one-based Row and Column values and owned Text; ReadPortablePrintFontZero returns the source listing font as a TXLSPortableCell

IXLSPortablePrintFontSource.ResolvePortablePrintFontZero, implemented by TXLSXReadOnlyWorkbookView, additionally accepts Script and LanguageTag for source-theme resolution

These source methods accept TXLSPortablePrintSourceLimits with MaxComments, MaxBytes, MaxCharacters and MaxSteps, report UsedBytes, UsedCharacters and UsedSteps, and take IXLSPortablePrintCancellation; its ShouldCancel method returns True to stop capture or planning, and callbacks must keep the active workbook and worksheet context

IXLSPortablePrintTextMeasurer.Measure measures a detached cell at a positive WidthPoints and returns an IXLSPortablePrintTextLayout; its Generation must match the snapshot, ResidentBytes accounts for retained measurement resources, and ShapedCharacters reports shaping work

IXLSPortablePrintTextLayout.Generation identifies the matching snapshot; NormalizedText owns the measured text, WidthPoints reports the layout width, LineCount and zero-based Lines expose TXLSPortablePrintMeasuredLine records, and ResourceBytes accounts for retained resources

A measured line carries its source range and glyph count, width, height, ascent, descent and baseline in points; TXLSPortablePrintTextSlice retains a layout, FirstLine, LineCount and destination LeftPoints and TopPoints, whilst TXLSPortablePrintTextSlices collects slices for a TXLSPortablePrintPageKind

Header resources and appearance diagnostics

TXLSHeaderFooterVariants carries the Classic header/footer page variants used by the adapter; TXLSPortableHeaderPageKind distinguishes odd, even and first pages, and TXLSPortableHeaderThemeColors contains the twelve source theme colour slots

TXLSPortableHeaderFooterPictures collects TXLSPortableHeaderFooterPicture records with page kind, section position, encoded image data, physical size and offsets, plus cropping, sampling and UnsupportedAppearance diagnostics

TXLSPortableHeaderInlinePictures contains TXLSPortableHeaderInlinePicture records tying a picture object to a text object and text offset, with physical offsets for inline placement

TXLSXHeaderFooterImage.PortableAppearanceSupported reports whether the captured source image appearance is modelled, and PortableAppearanceIssue describes a rejected appearance; TXLSXHeaderFooterImages.PortableSourceIssue reports collection-level source problems

TXLSXWorkbook.ResolveHeaderFooterThemeFont resolves the requested major or minor source font for a script; unsupported source theme structure reports an error rather than guessing a face

TXLSPortablePrintErrors is the detached error-output policy PrintErrors uses; its values affect captured error identities rather than ordinary text strings

Scaling mode and native defaults

TXLSXWorksheet.PageFitToPages chooses fit mode independently of its dimensions: assigning FitToWidth or FitToHeight selects fit mode, and assigning PageScale selects percentage scaling

XLSX import preserves sheetPr/pageSetUpPr/@fitToPage together with the OOXML default of one for an omitted fit dimension; export keeps explicit zero dimensions, and XLS/XLSX conversion preserves the selected mode

Percentage scaling disregards stale fit dimensions; fit mode disregards a stored percentage scale, and positive fit dimensions disregard manual breaks; zero on both axes keeps manual breaks at 100% scale, whilst positive limits shrink oversized content without enlarging a small range

Logical pagination depends on the snapshot geometry you supply; printer-driver metrics and Excel PDF export scaling can change the physical output and offer no exact visual equivalence guarantee

Build a detached plan directly

CreateXLSPortablePrintPlan(Snapshot, Areas, Options) takes zero-based inclusive TXLSPortablePrintRanges; an empty Areas array means the whole snapshot, and each TXLSPortablePrintRange carries FirstRow, FirstColumn, LastRow and LastColumn

Begin with XLSDefaultPortablePrintOptions, then set the fields of TXLSPortablePrintOptions listed below

FieldsContract
PageWidthPoints, PageHeightPointsPositive physical paper dimensions in points, default A4
MarginLeftPoints, MarginTopPoints, MarginRightPoints, MarginBottomPointsNonnegative margins that leave a positive printable rectangle, default 36 points
Landscape, CenterHorizontally, CenterVerticallyLandscape swaps the portrait dimensions; centring applies to each page body and its repeated titles
ScalePercent10 through 400, default 100; applies when neither fit dimension is positive
FitToPagesWide, FitToPagesTallNonnegative page limits, zero for an unrestricted axis; positive limits search out a feasible scale between 10% and 100%
TitleFirstRow, TitleLastRow, TitleFirstColumn, TitleLastColumnComplete zero-based inclusive title ranges, or -1 on both endpoints to switch that axis off
RowBreaks, ColumnBreaksTXLSPortablePrintBreaks arrays of strictly ascending unique zero-based positions at which a new page begins; workbook adaptation sorts detached metadata without editing the sheet
OrderTXLSPortablePrintOrder: xppoDownThenOver or xppoOverThenDown
MaxPagesPositive total page limit, default 256 and maximum 100,000
MaxPlanBytesWorking storage, the detached snapshot payload and page records share this positive memory budget, default 64 MiB and maximum 1 GiB
MaxPlanningStepsPositive bounded planning work budget, default 64 Mi steps and maximum 2 Gi steps; going over it raises EXLSPortablePrintBudget

Geometry must be finite; hidden dimensions have zero size, a page break may not split a merge, an area or title may not partially overlap a merge, and an oversized cell or merge is refused rather than being silently cut

Inspect or render the result

IXLSPortablePrintPlan.Snapshot owns a detached immutable render snapshot, PageCount reports the logical page count, and zero-based Pages[Index] hands back a TXLSPortablePrintPage with a detached tile array

Each page exposes AreaIndex, AcrossIndex, DownIndex, its zero-based inclusive Body and Scale, plus PageWidthPoints, PageHeightPoints and Tiles

TXLSPortablePrintTiles holds at most four TXLSPortablePrintTile records covering the repeated corner, title rows, title columns and body; each tile exposes unscaled source SourceLeft, SourceTop, SourceRight, SourceBottom and physical destination DestinationLeft, DestinationTop

The PrepareXLSPortableCairoLayout(Plan, Fonts, Options) overload keeps detached page records, clips and scales scene content for each tile and works from the plan's paper dimensions and margins; raster, font, shaping and drawing budgets keep applying to repeated content

Layout.PageCount matches the plan; PDF produces one multipage file, whilst SVG and PNG produce one file per logical page; the layout's text-line inspection keeps unscaled snapshot coordinates rather than per-page repeated positions

Existing output files are refused, and the Windows native Cairo entry point stays explicitly unsupported; see portable headless output for the dependency, font mapping, scene and output limits