HotXLS Docs

Workbook Viewer Feature

Overview

In addition to file manipulation, Delphi desktop applications often need to visually display workbooks to users; HotXLS includes a visual control to render spreadsheets directly inside VCL and FMX forms

TXLSWorkbookViewer Control

The TXLSWorkbookViewer component provides scrolling, rectangular selection, editing, formula input, comments, hyperlinks, conditional formatting, and print preview without creating temporary files

Assign Workbook for classic XLS or XlsxWorkbook for XLSX and ODS workbooks, or call LoadFromFile to let the control own the loaded workbook

Editing and Formula Input

Set Editable to True to enable F2, double-click, printable-key, Delete, and formula-bar editing; protected locked cells remain read only whilst explicitly unlocked cells remain editable

FormulaBarText returns the selected cell formula with its leading equals sign or its input value, and assigning the property applies a new formula or typed value and recalculates dependent formulas

Undo and Redo use a bounded circular history controlled by UndoLimit; undoing a newly created XLSX cell restores its absent sparse-storage state. Each history entry is a TXLSViewerCellState snapshot (workbook kind, existence, sheet, coordinates, formula, value, and format state), also available through the public state-reading method

The editing hooks are typed callbacks: OnBeforeEdit (a TXLSViewerBeforeEditEvent) receives the proposed text and can veto or rewrite it through Allow and Text, and OnAfterEdit (a TXLSViewerAfterEditEvent) reports the committed text

Viewer.Editable := True;
Viewer.GoToCell(2, 3);
Viewer.FormulaBarText := '=A1*2';
Viewer.Undo;
Viewer.Redo;

Range and Reference Selection

Use Shift navigation, mouse dragging, or SelectRange to create a rectangular selection exposed through SelectionTop, SelectionLeft, SelectionBottom, SelectionRight, and SelectedRange

BeginReferencePick enables formula-reference mode and OnReferencePick (a TXLSViewerReferenceEvent) publishes the current A1 range whenever the selection changes; call EndReferencePick when the host formula editor has accepted the reference

Display Properties

Check the configuration controls below