HotXLS Docs

Cells and Ranges

A common task when using HotXLS is to specify a cell or range of cells and then do something with it, such as entering a value or changing the format
A Range object in HotXLS can be either a single cell or a range of cells. The topics below show the most common ways to identify and work with Range objects
 
»Cell and Range A1 notation
»Cell Index numbers
»Range Index numbers
»Referring to Rows
»Referring to Columns
»Range Offset

Bounded Classic stored chart-cell inspection

TXLSWorksheet.ReadCachedChartCell(Row, Col, MaxBytes, MaxTextCharacters) reads zero-based Classic XLS coordinates without creating cells, calculating formulas, cloning compiled formulas, warming the shared-string cache or altering the workbook generation

The returned TXLSCachedChartCell has Kind: TXLSCachedChartCellKind, Number: Double, Text: WideString, ReadBytes: Int64, TextCharacters: Int64, Generation: UInt64 and CacheState: TXLSFormulaCacheState; ccckAbsent represents missing or empty content and merged non-anchor cells, ccckNumber represents a finite numeric result, and ccckText contains a detached counted UTF-16 string

Formula cells require a stored xlfcsLoaded or xlfcsCalculated cache; missing or invalidated caches raise EInvalidOperation instead of evaluating the formulas, whilst stored empty or null caches return ccckAbsent

Shared-string length and cached varUString or varOleStr length are checked before copying, preserving embedded NUL characters and surrogate code units; arrays, by-reference variants, errors, Boolean values and ANSI varString caches and unknown cache types are explicitly unsupported

A text result of n UTF-16 code units charges ReadBytes = 4*n and TextCharacters = 2*n for the counted source and the detached output; a number charges eight bytes and no text characters, whilst absence charges neither

The method rejects negative limits with EArgumentOutOfRangeException, coordinates outside rows 0 through 65535 or columns 0 through 255 with ERangeError, and exceeded limits or non-finite values with EInvalidOperation; callers must also budget any numeric formatting or category text copied from the returned value

Stored calendar dates and typed varDate formula caches follow the current workbook Date1904 setting, whilst ordinary numeric doubles retain their exact stored value; a calendar date stored in the phantom 1900 interval [60, 61) is rejected rather than treated as a real date

TXLSWorksheet.IsCachedChartCellVisible(Row, Col) uses the same zero-based coordinate bounds and reads the stored row and column hidden flags without materialisation; a chart capture that requires visible-only plotting must check this result and apply the documented hidden-data policy

Both methods acquire a nested workbook read lease; a multi-cell chart source must hold an outer lease, verify the returned Generation, resolve formula references against the exact borrowed workbook and local worksheet without external or spanning references, and must validate reference bounds and formula provenance before using the values

XLSX in-cell images and checkboxes

TXLSXCell.SetInCellImage(Data, ContentType, AltText, Decorative) stores a local PNG or JPEG as the cell content, with copied encoded bytes and a rich-value metadata graph in the XLSX package

The setter validates PNG chunk bounds, checksums and the end marker, or JPEG frame and container markers, before changing the cell; raster decoding remains the renderer's responsibility

ContentType is image/png or image/jpeg, Decorative defaults to False, and AltText is preserved as image metadata

SetInCellImage replaces the formula, cached content and rich text, rejects array-formula cells and uses #VALUE! as the ordinary fallback cell value; the library does not calculate the IMAGE function or download remote images

InCellImage returns a detached TXLSInCellImageSnapshot with Availability: TXLSCellFeatureAvailability, Data, ContentType, AltText, Decorative and CalcOrigin; xlcfaAbsent means no image metadata, xlcfaSupported means a resolved local PNG or JPEG, and xlcfaUnsupported means the existing metadata cannot be interpreted safely

ClearInCellImage removes the image and clears its fallback value; assigning a different value or formula removes the image as part of replacing the cell content

TXLSXCell.SetCheckbox(DefaultState: TXLSCheckboxDefaultState) creates a cell-control format and initialises the value, with xlcdUnchecked, xlcdChecked or xlcdBlank; the default is xlcdUnchecked

CellControl returns TXLSCellControlSnapshot with Kind: TXLSCellControlKind, DefaultState and the underlying Value; kinds are xlcctNone, xlcctUnknown and xlcctCheckbox

The Checkbox format is a form of formatting, so value or formula assignments retain it and Range.Clear clears content while retaining the format; ClearCellControl removes that format while preserving the value, and Range.ClearAll removes both

TXLSXWorksheet.ReadInCellImage(Row, Col, MaxBytes) and TXLSXWorksheet.ReadCellControl(Row, Col) read one-based coordinates under a read lease without creating missing cells or triggering recalculation; MaxBytes defaults to High(Int64) and rejects an oversized image before copying its bytes

Explicit cell-level styles, local image metadata, default Checkbox state and Boolean values survive XLSX save and reload, range copies and moves, structural row or column edits and same-workbook content snapshot restoration; supported cross-workbook copies rebuild the destination references

Unknown control bags, rich-value types and malformed references remain explicitly unsupported; ordinary Open XML saves retain their source metadata when PreserveUnsupportedParts is enabled, whilst copying unknown cell-feature metadata to another workbook is rejected before the destination is changed

Adding a supported feature to an imported property bag or image graph that has an unsupported namespace or conflicting owner relationships is rejected on save rather than rebuilding the graph from guessed metadata

Sparse inherited Checkbox formats

TXLSXWorksheet.SetRowCheckboxFormat(FirstRow, LastRow, DefaultState) and SetColumnCheckboxFormat(FirstCol, LastCol, DefaultState) apply an inclusive one-based axis span without creating cells or setting values; DefaultState defaults to xlcdUnchecked

ClearRowCellControlFormat(FirstRow, LastRow) and ClearColumnCellControlFormat(FirstCol, LastCol) explicitly clear the corresponding inherited format whilst preserving values; invalid spans raise EArgumentOutOfRangeException before mutation

Direct cell controls and direct clears take precedence over inherited formats, finite copied format regions take precedence over rows, and rows take precedence over columns irrespective of assignment order; the latest assignment at the same level wins

An imported cell element has a direct default XF when its s attribute is omitted, preserving the empty clear masks Excel writes without an explicit zero index; missing cell elements still inherit the axis format

An absent cell retains Value = Unassigned even when its inherited Checkbox default is checked; the default is insertion metadata and never manufactures a Boolean value during reading or rendering

FormatIndex assignment replaces the direct control format, including an explicit zero assignment that masks inherited controls; partial font, fill, border, number, alignment or protection changes retain it

Inherited formats survive structural edits, supported range and sheet copies and XLSX roundtrips; a cross-workbook copy remaps known property bags and rejects unknown inherited control metadata before the destination changes

Save and semantic normalisation check sparse boundary complexity before traversing it, with limits of 1,000,000 partitions and 16,000,000 estimated overlay-resolution checks; an over-fragmented control graph raises EXLSXSemanticBudget instead of starting an unbounded Cartesian walk

TXLSXRange.ApplyFormatPatch accepts xfpCellControl to copy the effective Checkbox format or clear it without changing values, replacing existing direct control formats and rejecting unknown controls before mutating the destination

TXLSXCellStyleState.CellControlSlot is the overlay representation: zero is an explicit clear, 1 through 3 identify unchecked, checked and blank Checkbox defaults, and negative slots reference imported feature XFs; imported slot numbers belong to their own workbook and must be remapped when copying across workbooks

Read-only control snapshots and semantic comparison use the effective sparse format without materialising missing cells; content snapshots preserve direct control masks, and CellImageCount counts stored supported or unsupported in-cell image carriers and never copies image bytes

Portable capture draws Boolean Checkbox values and explicitly rejects blank or non-Boolean Checkbox appearance; the requested grid quota is checked before walking any large inherited span

These APIs are available on TXLSXWorkbook cells; the Classic XLS engine does not offer modern cell-control or rich-value image creation

GetConversionReport reports in-cell image and cell-control losses for OpenDocument and XLSB output, which retain fallback values while omitting the modern feature metadata; use checked saving to review those losses or reject them

The package graph follows Microsoft's local image rich-value specification and Checkbox feature property bag specification; availability in a particular Excel build does not establish support in this library, nor do library roundtrips establish native rendering equivalence in an Excel build lacking these features

The compatibility probe on Excel 16.0 build 20430 opened and saved the generated Checkbox package but exposed no usable Checkbox or local in-cell image authoring API; it opened the image package with the required rich-value metadata flags and replaced its unsupported local image with #FIELD! on re-save