MagiXells developer documentation

Embeddable Delphi / C++Builder spreadsheet control (TMagiXells / TFmxMagiXells) with shared Core, XLSX/ODS/MGX/CSV I/O, formulas, charts, and an optional AI agent.

Visibility rule: API pages document only Public and Published members. Private/protected members are omitted. Guide samples call only those APIs.

Start here

  1. Getting started — install Setup.exe, drop a control, load/save; measurement units
  2. C++Builder — same packages from C++ (headers, SheetAPI without helpers, AI)
  3. Architecture — Core vs hosts; what you own vs what MagiXells owns

Guides

Guide Topics
C++Builder Setup.exe install, VCL/FMX C++, SheetAPI, AI, Delphi↔︎C++ map
Workbook & editing Sheets, selection, edit, undo, protection
Formatting Font/fill/border via control and SheetAPI
Formulas Recalc, named ranges, dynamic arrays
Import / export XLSX, ODS, MGX, CSV, streams
Charts & drawings Charts, pictures, shapes via SheetAPI
PivotTables Field List, refresh, GETPIVOTDATA, slicers/OLAP
Print Page setup, preview, print area
RTL & themes Sheet RTL, Appearance / UiTheme
AI agent Config, Run/RunAsync, host UI, tools

Also: Formulas overview

API reference

Every exposed member includes Where used, How to use, and a Delphi example (see API index). Trial/Runtime installs ship without library source — docs are the contract. For C++Builder call shapes, see C++Builder.

Page Covers
API index How to navigate the reference
TMagiXells / TFmxMagiXells Control methods, properties, events
MagiXells.Types Addresses, ranges, cell values, ColToLetters, file formats
Host options & UiTheme Behavior, ViewOptions, Protection, TabBar, NamedRanges, Appearance
SheetAPI Cell, Range, AuthoringSheet, workbook helpers
AI agent TMagiXellsAIAgent, config, host, tools

Demos

After Setup, open demos from Start Menu → Binary Magic → MagiXells (VCL/FMX hosts, feature samples). View → Pivot Field List inserts/refreshes PivotTables from a selection.

Getting started

Install MagiXells with the Setup program, drop a control on a form, and load/save a workbook.

Prerequisites

C++Builder uses the same packages and Public API via generated .hpp files — see C++Builder.

Trial install

The public trial ships compiled packages only for supported Delphi / C++Builder IDEs (BPLs/DCPs/DCUs — MagiXells library .pas units are not included). The grid always shows an evaluation watermark.

  1. Close RAD Studio
  2. Run MagiXells-Trial-Setup.exe (installs into every supported IDE found on the machine)
  3. Restart the IDE; drop TMagiXells or TFmxMagiXells from the MagiXells palette
  4. Optional demos: Start Menu → Binary Magic → MagiXells → Demo Projects

Evaluation only — not licensed for distribution (see LICENSE).

Silent: MagiXells-Trial-Setup.exe /VERYSILENT /NORESTART

Runtime install (licensed)

Same binary package installer as the trial, without the watermark. After purchase, run MagiXells-Runtime-Setup.exe, restart the IDE, and build as usual. Runtime Setup also does not include MagiXells library source.

Drop a control (VCL)

  1. Open a VCL form.
  2. From the MagiXells palette, drop TMagiXells.
  3. Set Align := alClient (Object Inspector or code).
uses
  MagiXells.Spreadsheet;

procedure TForm1.FormCreate(Sender: TObject);
begin
  MagiXells1.Align := alClient;
  MagiXells1.NewWorkbook;
end;

Drop a control (FMX)

  1. Open an FMX form.
  2. From the MagiXells palette, drop TFmxMagiXells.
  3. Align to client.
uses
  MagiXells.Spreadsheet.Fmx;

procedure TForm1.FormCreate(Sender: TObject);
begin
  FmxMagiXells1.Align := TAlignLayout.Client;
  FmxMagiXells1.NewWorkbook;
end;

Load and save

Format is inferred from the file extension (.xlsx, .ods, .mgx, .csv).

MagiXells1.LoadFromFile('C:\Data\report.xlsx');
MagiXells1.SaveToFile('C:\Data\report.mgx');

Streams require an explicit format:

uses
  MagiXells.Types;

var
  MS: TMemoryStream;
begin
  MS := TMemoryStream.Create;
  try
    MagiXells1.SaveToStream(MS, ffXlsx);
    MS.Position := 0;
    MagiXells1.LoadFromStream(MS, ffXlsx);
  finally
    MS.Free;
  end;
end;

First edits via the control

MagiXells1.SelectRange(0, 0, 2, 0); // A1:C1 (0-based col/row)
MagiXells1.SetNumberFormat('0.00');
MagiXells1.MergeCells;

First edits via SheetAPI

uses
  MagiXells.SheetAPI;

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].Text := 'Hello';
  S.Cell['B1'].AsNumber := 42;
  S.Cell['C1'].Formula := '=B1*2';
  MagiXells1.Recalculate;
end;

Run the demos

After install, open demos from Start Menu → Binary Magic → MagiXells → Demo Projects (VCL and FMX).

Sample workbooks may also be included with the product (for example a feature showcase .xlsx).

Measurement units

These values are not pixels unless the API says so. MagiXells matches Excel’s workbook units; the grid converts them to screen pixels using DPI and Zoom.

What Unit Example
Column width (DefaultColWidth, SetColWidthChars, resize events *WidthChars) Excel character units — how many “0” glyphs of the Normal font fit in the column 10 ≈ Excel’s default column
Row height (DefaultRowHeight, SetRowHeightPt, resize events *HeightPt) Points (1 pt = 1/72 inch) 15 is Excel’s default row
Font size (DefaultFont.Size, Font.Size, FontSize) Points 11 is Calibri 11 pt
Zoom Percent 100 is 100%; 400 is 400%
Row-number gutter (RowHeaderWidth) Pixels at 96 DPI, then scaled with zoom and screen DPI — or auto-sized to the largest visible row number when AutoRowHeaderWidth is on (default) 40 is 40 px at 96 DPI / 100% zoom
Column-letter gutter (ColHeaderHeight) Pixels at 96 DPI, then scaled with zoom and screen DPI 22 is 22 px at 96 DPI / 100% zoom
Chart AWidthCols / AHeightRows Count of grid columns / rows the drawing spans 8 columns wide

Character units are not CSS ch and not device pixels. A “1 px” gutter in the painted grid is one device pixel at 96 DPI / 100% zoom, and it scales with zoom the same way column pixels do.

Next steps

Architecture

High-level layout for integrators. No internal-unit APIs are documented here.

Layers

flowchart TB HostApp[Host application] Control[TMagiXells / TFmxMagiXells] Core[MagiXellsCore workbook formulas I/O] HostApp --> Control Control --> Core AIHost[AI Host adapter] Agent[TMagiXellsAIAgent] HostApp --> Agent Agent --> AIHost AIHost --> Control
Layer Role
Host app Menus, ribbon, dialogs, AI chat chrome (you own these)
Control TMagiXells / TFmxMagiXells — formula bar, sheet tabs, grid interaction
Core Workbook model, formulas, sparse grid, import/export, undo
AI agent Optional LLM tool loop; talks to the workbook through IMagiXellsAIHost

Packages link into your EXE (no separate MagiXells runtime DLL). C++Builder hosts use the same packages via generated .hpp headers — see C++Builder.

What MagiXells owns

What the host owns

VCL vs FMX

VCL FMX
Control TMagiXells TFmxMagiXells
Runtime package MagiXellsPkg MagiXellsFmx
Design package MagiXellsDesign MagiXellsFmxDesign
Palette MagiXells MagiXells
AI host TMagiXellsAIHost TFmxMagiXellsAIHost

Public MagiXells methods and events are parity-first. Prefer VCL Delphi snippets in API pages; swap the control type for FMX. For C++Builder hosts, see C++Builder.

Authoring paths

  1. Control API — selection-based (MergeCells, PasteValues, SetFont, …). Natural for UI-driven hosts.
  2. SheetAPI — A1-style Cell / Range / UseActiveSheet (Delphi helpers) or TSheetCellRef::Create / TAuthoringSheet::Create (C++Builder).
  3. AI agent — natural language → tools that mutate the same workbook (undoable).

Cloud

src/Cloud/ stays in MagiXellsCore as a local preview, not a hosted product and not a Public API.

TMagiXellsCloudApiClient reads and writes %TEMP%\<DocumentId>.mgx. Login always returns False and does not mint a session token. TMagiXellsSyncEngine keeps an in-memory patch list and uploads through that same TEMP file. Do not treat BaseUrl as a live REST endpoint.

Workbook and editing

Sheets, selection, in-place edit, clipboard, undo, and protection via Public control APIs.

New / load workbook

MagiXells1.NewWorkbook;
MagiXells1.LoadFromFile('budget.xlsx');
if MagiXells1.Modified then
  MagiXells1.SaveToFile('budget.xlsx');

Sheets

MagiXells1.AddSheet('Sales');
MagiXells1.ActiveSheetIndex := MagiXells1.SheetCount - 1;
MagiXells1.RenameSheet(MagiXells1.ActiveSheetIndex, 'Q1 Sales');
// MagiXells1.RemoveSheet(1);

Listen for tab changes:

procedure TForm1.MagiXells1SheetChanged(Sender: TObject);
begin
  Caption := MagiXells1.ActiveSheet.Name;
end;

Selection and navigation

Columns and rows are 0-based on the control API. Column width is Excel character units; row height is points — see measurement units.

MagiXells1.SelectCell(0, 0);           // A1
MagiXells1.SelectRange(0, 0, 3, 10);   // A1:D11
MagiXells1.ScrollToCell(0, 50);
MagiXells1.EnsureSelectionVisible;
MagiXells1.ActiveCol := 2;
MagiXells1.ActiveRow := 5;
procedure TForm1.MagiXells1SelectionChanged(Sender: TObject);
begin
  StatusBar1.SimpleText := Format('Col=%d Row=%d',
    [MagiXells1.ActiveCol, MagiXells1.ActiveRow]);
end;

In-place editing

MagiXells1.BeginEdit('=SUM(A1:A10)');
if MagiXells1.IsEditing then
  MagiXells1.EndEdit;   // or CancelEdit

Events: OnBeforeEdit, OnEditStart, OnEditCommit, OnEditCancel, OnEditTextChanged, OnFormulaEdited.

procedure TForm1.MagiXells1BeforeEdit(Sender: TObject; ACol, ARow: Integer;
  var FAllowed: Boolean);
begin
  FAllowed := ACol > 1; // block edits in column A
end;

procedure TForm1.MagiXells1ActiveCellChanging(Sender: TObject;
  ACol, ARow: Integer; var Allow: Boolean);
begin
  Allow := ARow >= 1; // lock header row
end;

Clipboard

Copy/paste uses an internal MagiXells buffer (formulas, formats, in-cell rich text) plus Windows HTML Format and TSV so Excel/Word/browser interchange keeps bold/italic/color runs.

MagiXells1.Behavior.AllowCopy := True;
MagiXells1.Behavior.AllowPaste := True;
MagiXells1.CopySelection;
MagiXells1.CutSelection;
MagiXells1.PasteAll; { HTML from Excel/Word/browser keeps bold/italic/color; multiline becomes rows }
MagiXells1.PasteValues;
MagiXells1.PasteFormulas;
MagiXells1.PasteFormats;

Clear and structure

MagiXells1.ClearContents;
MagiXells1.ClearFormats;
MagiXells1.ClearAll;
MagiXells1.InsertSelectionRows;
MagiXells1.DeleteSelectionColumns;
MagiXells1.InsertRows(5, 2);
MagiXells1.DeleteColumns(2, 1);

Undo / redo

MagiXells1.Behavior.HistoryEnabled := True;
MagiXells1.Behavior.HistoryLimit := 100;
if MagiXells1.CanUndo then MagiXells1.Undo;
if MagiXells1.CanRedo then MagiXells1.Redo;
procedure TForm1.MagiXells1HistoryChanged(Sender: TObject);
begin
  actUndo.Enabled := MagiXells1.CanUndo;
  actRedo.Enabled := MagiXells1.CanRedo;
end;

Protection and read-only

MagiXells1.ReadOnly := True;
MagiXells1.Protect;
MagiXells1.Unprotect;
MagiXells1.ProtectStructure;
MagiXells1.UnprotectStructure;
MagiXells1.Protection.AllowFormatCells := False;

Batch updates

MagiXells1.BeginUpdate;
try
  { many SheetAPI or selection edits }
finally
  MagiXells1.EndUpdate;
end;

While updating, MagiXells defers grid painting, formula auto-calc, live chart refresh, auto row-height, and OnModified. The outer EndUpdate runs one recalc (if auto-calc is on), refreshes row heights/charts, then a single repaint.

OnCellChanged is not used for programmatic SheetAPI / SetCell writes (only interactive edits). Nested BeginUpdate/EndUpdate pairs are supported. ## View chrome

MagiXells1.ShowFormulaBar := True;
MagiXells1.ShowSheetTabs := True;
MagiXells1.ShowHeaders := True;
MagiXells1.ShowGridLines := True;
MagiXells1.FrozenRows := 1;
MagiXells1.FrozenCols := 1;
MagiXells1.Zoom := 120;

See also

Formatting

Apply formats through the control (selection-based) or SheetAPI (A1-based).

Via the control (current selection)

uses
  MagiXells.CellFormat;

var
  Font: TCellFontInfo;
  Fill: TCellFillInfo;
  Align: TCellAlignmentInfo;
begin
  MagiXells1.SelectRange(0, 0, 4, 0);

  Font := Default(TCellFontInfo);
  Font.Name := 'Calibri';
  Font.Size := 12;
  Font.Bold := True;
  MagiXells1.SetFont(Font);

  Fill := Default(TCellFillInfo);
  Fill.PatternType := cfpSolid;
  Fill.FgColor.RGB := $00D6EAF8; // COLORREF BGR
  MagiXells1.SetFill(Fill);

  Align := Default(TCellAlignmentInfo);
  Align.Horizontal := haCenter;
  Align.Vertical := vaCenter;
  MagiXells1.SetAlignment(Align);

  MagiXells1.SetNumberFormat('$#,##0.00');
  MagiXells1.MergeCells;
end;
MagiXells1.UnmergeCells;
var
  Fmt: TCellFormat;
begin
  Fmt := MagiXells1.GetActiveCellFormat;
  // inspect Fmt.Font / Fmt.Fill / …
end;

Via SheetAPI

uses
  MagiXells.SheetAPI, MagiXells.SheetAPI.Colors;

var
  S: TAuthoringSheet;
  R: TSheetRangeRef;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].Text := 'Title';
  S.Cell['A1'].FontBold := True;
  S.Cell['A1'].FontSize := 14;
  S.Cell['A1'].FontColor := TColor($1F4E79);
  S.Cell['A1'].FillColor := TColor($D6EAF8);
  S.Cell['A1'].HorizontalAlignment := haCenter;

  R := S.Range('A1:D1');
  R.BorderAround(blsThin, TColor($000000));
  R.NumberFormat := '0.00';
  R.Merge;
end;

Rich text on a cell:

{ Simple HTML (bold / italic / underline / color / font): }
S.Cell['A2'].SetHtml('<b>Bold</b> and <i>italic</i>');

{ Run-based API (still supported): }
S.Cell['A3'].ClearRichText;
S.Cell['A3'].AddRun('Bold ', [rfBold]);
S.Cell['A3'].AddRun('and normal');

Behavior flags

MagiXells1.Behavior.AllowFormat := True;
MagiXells1.Behavior.AllowEdit := True;

See also

Formulas

Recalculation, named ranges, and dynamic arrays through Public APIs.

Enter formulas

SheetAPI:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].AsNumber := 10;
  S.Cell['A2'].AsNumber := 20;
  S.Cell['A3'].Formula := '=SUM(A1:A2)';
  MagiXells1.Recalculate;
end;

User edits commit through the formula bar / in-place editor; with Behavior.AutoCalculate := True (default), dependents update automatically.

Manual recalculation

MagiXells1.Behavior.AutoCalculate := False;
// … edit many cells …
MagiXells1.Recalculate;

Named ranges

Control façade:

MagiXells1.NamedRanges.AddOrSet('SalesData', 'Sheet1!$A$1:$B$20');
if MagiXells1.NamedRanges.Contains('SalesData') then
  ShowMessage(MagiXells1.NamedRanges.GetFormula('SalesData'));

SheetAPI workbook helper:

MagiXells1.Workbook.Names.Define('TaxRate', '0.2');

Formulas can reference names: =SUM(SalesData).

Show formulas

MagiXells1.ShowFormulas := True;  // or ViewOptions.ShowFormulas

Dynamic arrays

Engine supports spill arrays (FILTER, SEQUENCE, UNIQUE, SORT, …). Write the formula normally:

S.Cell['D1'].Formula := '=SEQUENCE(5,1,1,1)';
MagiXells1.Recalculate;

See Formulas overview for categories (~500 Excel-compatible builtins).

Evaluate without changing the sheet

Use Evaluator.Evaluate to compute a formula string in memory. It does not write to any cell or mark the workbook modified. Cell references (for example A1) resolve against the given sheet index, or the active sheet when omitted.

uses
  MagiXells.Types; // TCellValue

var
  V: TCellValue;
begin
  // Literals / expressions — no sheet write
  V := MagiXells1.Evaluator.Evaluate('=1+2*3');
  ShowMessage(V.ToDisplayString); // '7'

  // Relative to the active sheet
  V := MagiXells1.Evaluator.Evaluate('=SUM(A1:A10)');

  // Pin a sheet index (0-based)
  V := MagiXells1.Evaluator.Evaluate('=B2*TaxRate', MagiXells1.ActiveSheetIndex);

  case V.Kind of
    cvkNumber:  Caption := FloatToStr(V.Number);
    cvkText:    Caption := V.Text;
    cvkBoolean: Caption := BoolToStr(V.BooleanValue, True);
    cvkError:   Caption := V.ToDisplayString; // e.g. #DIV/0!
  else
    Caption := V.ToDisplayString;
  end;
end;

Prefer this over writing a temporary cell when you only need a what-if result. Avoid EvaluateCell / Recalculate for that case — those update cell caches or the workbook.

Evaluator access

MagiXells1.Evaluator is the shared TFormulaEvaluator for the control’s workbook (Evaluate, EvaluateCell, RecalculateAll, …). Same instance is used by auto-calc and MagiXells1.Recalculate.

if MagiXells1.Evaluator <> nil then
  MagiXells1.Recalculate; // full workbook recalc (writes caches)

Pivot / cube formulas

GETPIVOTDATA, GROUPBY, PIVOTBY, FIELDVALUE, and CUBE* are implemented. See PivotTables.

Web / RTD / stock / import

Function Behavior
ENCODEURL RFC 3986 percent-encode (UTF-8, %20 for space)
WEBSERVICE Sync HTTP GET; http(s) only; URL ≤2048 / body ≤32767; failures → #VALUE!
FILTERXML XPath 1.0 (MSXML on Windows); multi-node → spill column
IMPORTHTML Google Sheets: (url, "table"\|"list", index). MagiXells extras (optional): 4th = GVQL QUERY string or TRUE to materialize as Table; 5th = TRUE when 4th is a query. TRUE writes values, creates Table Import_<A1> + AutoFilter, clears the formula (one-shot). Google 3-arg formulas unchanged.
IMPORTDATA Fetch CSV/TSV URL → spill grid (delimiter auto-detected)
IMPORTXML Fetch URL + XPath → spill (uses FILTERXML engine)
IMPORTFEED Fetch RSS/Atom; default spill Title/URL/Date (items / feed / field queries)
IMPORTRANGE Host ImportRangeProvider required; else #N/A
GOOGLEFINANCE Host GoogleFinanceProvider or Yahoo default (price/open/high/low/volume + history)
GOOGLETRANSLATE / TRANSLATE Host TranslateProvider required; else #N/A
DETECTLANGUAGE Host TranslateProvider required; else #N/A
STOCKHISTORY Spill table; host StockHistoryProvider if set, else Yahoo Finance chart v8
RTD Host RtdProvider first; else Windows COM IRtdServer; else #N/A

Also: REGEXEXTRACT / REGEXREPLACE / REGEXMATCH / REGEXTEST, ISEMAIL, ISURL, JOIN, ARRAY_CONSTRAIN, and QUERY (GVQL subset: SELECT/WHERE/ORDER BY/LIMIT/GROUP BY).

External data providers (VCL)

type
  TMyStockFeed = class(TInterfacedObject, IMagiXellsStockHistoryProvider)
  public
    function GetHistory(const ASymbol: string; AStart, AEnd: TDateTime;
      AInterval: Integer; out ABars: TArray<TStockHistoryBar>): Boolean;
  end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  MagiXells1.StockHistoryProvider := TMyStockFeed.Create;
  // MagiXells1.RtdProvider := MyRtdFeed;
  // MagiXells1.TranslateProvider := MyTranslate;
  // MagiXells1.ImportRangeProvider := MyImportRange;
  // MagiXells1.GoogleFinanceProvider := MyFinance; // else Yahoo defaults
end;

// When a live tick arrives:
MagiXells1.NotifyRtdUpdate('My.Feed', '', ['BID', 'MSFT']);

Interfaces live in MagiXells.ExternalData. Properties are on TWorkbook, TMagiXells, and TFmxMagiXells.

S.Cell['B3'].Formula := '=ENCODEURL("a b")';           // a%20b
S.Cell['B4'].Formula := '=STOCKHISTORY("MSFT",TODAY()-30,TODAY())';
S.Cell['B5'].Formula := '=RTD("My.Feed","","BID")';
{ Google-compatible live spill: }
S.Cell['A1'].Formula :=
  '=IMPORTHTML("https://en.wikipedia.org/wiki/List_of_S%26P_500_companies","table",1)';
{ MagiXells: import once as a sortable/filterable Table: }
S.Cell['A1'].Formula :=
  '=IMPORTHTML("https://en.wikipedia.org/wiki/List_of_S%26P_500_companies","table",1,TRUE)';
{ Or keep Google formula, then after Recalculate: }
{ S.MaterializeSpillAsTable('A1', 'SP500', True); }
MagiXells1.Recalculate;

WEBSERVICE / Yahoo STOCKHISTORY / IMPORTHTML run synchronously on the calc thread (bounded timeout). Prefer a host StockHistoryProvider in production apps.

See also

Import and export

Load/save through Public control methods. Format enum: TMagiXellsFileFormat in MagiXells.Types.

Value Meaning
ffAuto Infer from extension (file APIs)
ffMgx Native MagiXells JSON
ffXlsx Office Open XML workbook
ffOds OpenDocument Spreadsheet
ffCsv Comma-separated values

Files

MagiXells1.LoadFromFile('report.xlsx');
MagiXells1.SaveToFile('report.mgx');
MagiXells1.SaveToFile('report.ods');
MagiXells1.SaveToFile('export.csv');
MagiXells1.SaveToFile('report.pdf'); // calls ExportToPdf

Export APIs

Use explicit export methods when you do not want to change the current workbook file path:

uses
  MagiXells.IO.Csv, MagiXells.PageSetup;

var
  Job: TPrintJobSettings;
  Csv: TCsvExportOptions;
begin
  Job := TPrintJobSettings.Default;
  MagiXells1.ExportToPdf('report.pdf', Job);

  Csv := TCsvExportOptions.Default;
  Csv.Delimiter := ';';
  Csv.Utf8Bom := True;
  Csv.What := pwEntireWorkbook; // writes one CSV per visible sheet
  MagiXells1.ExportToCsv('report.csv', Csv);
end;

Progress for large loads:

procedure TForm1.MagiXells1Progress(Sender: TObject; APercent: Integer;
  const AStatus: string);
begin
  StatusBar1.SimpleText := Format('%d%% %s', [APercent, AStatus]);
end;

Streams

uses
  MagiXells.Types;

procedure SaveXlsxToStream(AGrid: TMagiXells; AStream: TStream);
begin
  AGrid.SaveToStream(AStream, ffXlsx);
end;

procedure LoadXlsxFromStream(AGrid: TMagiXells; AStream: TStream);
begin
  AStream.Position := 0;
  AGrid.LoadFromStream(AStream, ffXlsx);
end;

Modified flag

if MagiXells1.IsModified or MagiXells1.Modified then
  MagiXells1.SaveToFile(CurrentPath);
procedure TForm1.MagiXells1Modified(Sender: TObject);
begin
  actSave.Enabled := MagiXells1.Modified;
end;

Fidelity expectations

See also

Charts and drawings

The control paints drawings from files and allows single-object select, move, and resize (corner aspect lock). Multi-select, grouping, rotation handles, and in-place shape text editing are not in this MVP.

Use SheetAPI for authoring, host Appearance for chart series colors, or AI tools insert_chart / update_chart / list_charts / insert_picture / list_drawings — see AI agent API.


Workflow 1 — Data → chart → live refresh

  1. Write categories and values (or load a file).
  2. Call AddChart with values/categories formulas and an anchor cell.
  3. Change source numbers and Recalculate — the chart paints from live sheet data.
uses
  MagiXells.SheetAPI, MagiXells.Drawing;

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].Text := 'Month';
  S.Cell['B1'].Text := 'Sales';
  S.Cell['A2'].Text := 'Jan';
  S.Cell['B2'].AsNumber := 100;
  S.Cell['A3'].Text := 'Feb';
  S.Cell['B3'].AsNumber := 140;
  S.Cell['A4'].Text := 'Mar';
  S.Cell['B4'].AsNumber := 125;

  { Title, type, values formula, categories formula, anchor, width cols, height rows }
  S.AddChart('Sales', sctColumn, 'Sheet1!$B$2:$B$4', 'Sheet1!$A$2:$A$4', 'D2', 8, 12);
  MagiXells1.Recalculate;

  { Later: edit B3 and recalc — chart updates }
  S.Cell['B3'].AsNumber := 180;
  MagiXells1.Recalculate;
end;

Or use the overload that takes TArray<TSheetChartSeries> when you need multiple series / combo layouts.

Chart types commonly used with SheetAPI / AI: column, bar, line, pie, area, scatter, doughnut, radar (plus bubble/combo/stock where the model preserves them).


Workflow 2 — Pictures and shapes

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;

  { File-based logo at E2, size in pixels }
  S.AddPictureFromFile('logo.png', 'E2', 240, 120);

  { Or bytes + content type }
  // S.AddPictureFromBytes(PngBytes, 'image/png', 'E2', 240, 120);

  { Preset geometry name e.g. rect — floating shape }
  S.AddShape('rect', 'G2', 120, 80);
end;

Interaction: click a drawing to select; drag to move; corner grips resize (aspect lock). No multi-select/group/rotate/in-place text in this MVP.


Workflow 3 — Table + filter + sort next to a chart

Often you chart a table range; keep headers frozen or filtered for exploration.

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  { Assume A1:B4 already filled as in Workflow 1 }
  S.AddTable('SalesTable', 'A1:B4', True, True);
  S.EnableAutoFilter('A1:B4');
  S.Sort('A1:B4', 1, True, True);  { key col index relative to range; has header }
  S.AddChart('Sales', sctLine, 'Sheet1!$B$2:$B$4', 'Sheet1!$A$2:$A$4', 'D2', 8, 10);
end;

Smooth drawing (VCL)

Prefer GDI+ for shapes/charts/ink when you want anti-aliased edges:

MagiXells1.ViewOptions.SmoothDrawing := True;

Chart colors (host theme)

Series colors come from host chrome (Appearance), not the OOXML workbook theme alone:

uses
  MagiXells.UiTheme;

MagiXells1.Appearance.ChartSeries1 := $4472C4;
MagiXells1.Appearance.ChartSeries2 := $ED7D31;
MagiXells1.Appearance.ApplyPreset(utpExcelLight);

See Host options & UiTheme and RTL and themes.


AI agent prompts (optional)

Insert a column chart of B2:B12 with categories A2:A12 titled Sales at D2.
List drawings on this sheet, then delete chart 0 and insert logo.png at E2.

See also

PivotTables

MagiXells PivotTables refresh into sheet cells from a PivotCache (worksheet range, multi-consolidation, or OLAP/external connection). Use SheetAPI from code, the Field List UI in demos, or AI tools list_pivots / create_pivot / configure_pivot / refresh_pivot / delete_pivot — see AI agent API.

This guide walks through full workflows, not just API names.


Workflow 1 — Create and refresh from SheetAPI

Typical path: prepare a header + data block → AddPivotTable → assign row/column/value fields → RefreshPivotTable.

uses
  MagiXells.SheetAPI, MagiXells.Pivot;

var
  S: TAuthoringSheet;
  P: TPivotTable;
begin
  S := MagiXells1.Workbook.UseActiveSheet;

  { Source: headers in row 1, data below }
  S.Cell['A1'].Text := 'Region';
  S.Cell['B1'].Text := 'Product';
  S.Cell['C1'].Text := 'Amount';
  S.Cell['A2'].Text := 'East';
  S.Cell['B2'].Text := 'Widget';
  S.Cell['C2'].AsNumber := 120;
  S.Cell['A3'].Text := 'West';
  S.Cell['B3'].Text := 'Gadget';
  S.Cell['C3'].AsNumber := 90;
  S.Cell['A4'].Text := 'East';
  S.Cell['B4'].Text := 'Gadget';
  S.Cell['C4'].AsNumber := 50;

  { Dest E1 is the top-left of the refreshed pivot layout }
  P := S.AddPivotTable('SalesPT', 'A1:C4', 'E1');
  P.AddField(TPivotFieldRef.Create(0, pfrRow));           // Region (field index 0)
  P.AddField(TPivotFieldRef.Create(1, pfrColumn));        // Product
  P.AddField(TPivotFieldRef.Create(2, pfrValue, paSum));  // Amount
  S.RefreshPivotTable('SalesPT');
  MagiXells1.Invalidate;  { if your host needs a paint }
end;

After source edits, call RefreshPivotTable again (or the AI refresh_pivot tool) so cell values rebuild from the cache.

Other cache kinds

{ Multi-consolidation ranges }
P := S.AddPivotTableMulti('MultiPT', ['Sheet1!A1:C10', 'Sheet2!A1:C10'], 'E1');

{ OLAP / connection-based (needs a workbook connection id) }
P := S.AddPivotTableOlap('OlapPT', 'MyCubeConn', 'E1');

Also: AddSlicer, AddTimeline, AddPivotChart, SetSlicerSelection / ToggleSlicerItem, SetPivotFieldShowAs, AddPivotCalculatedField, AddOlapConnection, DeletePivotTable.


Workflow 2 — Field List UI (demo)

  1. Select a data range that includes a header row and data rows.
  2. VCL demo: View → Pivot Field ListInsert PivotTable from selection.
  3. Drag fields into Rows / Columns / Values / Filters.
  4. Optionally insert a Slicer or PivotChart, set show-as / calculated fields, then Refresh.
  5. FMX: use the DemoPivotPanel.Fmx sample frame (same actions).

Click slicer items on the sheet to filter and refresh linked pivots (undoable).


Workflow 3 — Slicer + PivotChart after a pivot exists

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  { Assume SalesPT already created and refreshed }
  S.AddSlicer('RegionSlicer', 'SalesPT', 'Region', 'A20');
  S.AddPivotChart('SalesPT', 'E20', 8, 12);  { width cols, height rows }
  S.SetSlicerSelection('RegionSlicer', ['East']);  { or ToggleSlicerItem }
  S.RefreshPivotTable('SalesPT');
end;

Keep slicer field names aligned with the pivot model; see TAuthoringSheet in SheetAPI for related helpers (AddTimeline, ClearSlicerSelection, SetPivotFieldShowAs, …).


Formulas against pivots

Formula Role
GETPIVOTDATA Query a refreshed pivot by field/item
GROUPBY / PIVOTBY Dynamic-array spills (SUM aggregation MVP)
FIELDVALUE Passthrough for calc-field style use
CUBE* Evaluate against workbook Connections (mock OLAP supported)
S.Cell['G1'].Formula := '=GETPIVOTDATA("Amount",$E$1,"Region","East")';
MagiXells1.Recalculate;

See Formulas overview for categories and Formulas guide for recalc.


Layout and look

Refresh defaults to Excel Compact form (one “Row Labels” column, outline subtotals above children, indented leaves) with a PivotStyleMedium-like header/group/total fill.

P.LayoutForm := plfTabular;  { one column per row field }
S.RefreshPivotTable(P.Name);

Excel-loaded pivots keep their cell values and gain the same visual chrome via ApplyLoadedPivotStyles.


Filter / sort dropdowns (VCL)

Chevron buttons match Excel: report-filter value cells, Row Labels, and Column Labels (when column fields exist). Not on measure captions (“Sum of Amount”), value headers, or each product/item column. Click for Sort A↔︎Z, Clear Filter, and a value list.


Aggregates and options

Aggregates: Sum, Count, CountNums, Average, Min, Max, Product, StdDev/StdDevp, Var/Varp.

Show-values-as: % of grand/row/col, index, rank, running total — via SetPivotFieldShowAs.

Grouping: date levels, numeric buckets, manual item groups. Calculated fields (Field+Field / Field*n) and calculated items on the model (AddPivotCalculatedField).


I/O

Format Behavior
MGX pivotCaches + per-sheet pivotTables
XLSX Loads Excel pivotCacheDefinition / pivotTable parts into the MagiXells model (worksheet/table sources); also writes MagiXells metadata in xl/magixells/pivots.json on save. Refreshed values remain in worksheet cells.

Known limits


See also

Print

Page setup, preview, print area, and print titles via public control methods (VCL TMagiXells / FMX TFmxMagiXells) and SheetAPI. AI tools print_preview / print / set_print_area call the same host surface — see AI agent API.


Workflow 1 — Page setup → preview → print

  1. Open page setup so the user can set paper, margins, orientation, headers/footers.
  2. Preview with default or custom TPrintJobSettings.
  3. Print (optionally showing the system print dialog).
uses
  MagiXells.PageSetup;

var
  Job: TPrintJobSettings;
begin
  { Modal page setup — True if the user accepted }
  if MagiXells1.ShowPageSetup then
    { changes are stored on the sheet/workbook page setup };

  MagiXells1.PrintPreview;           { default job }
  MagiXells1.Print(True);            { show print dialog }

  Job := TPrintJobSettings.Default;
  Job.What := pwActiveSheets;        { or pwSelection / pwEntireWorkbook }
  Job.Copies := 1;
  MagiXells1.PrintPreview(Job);
  MagiXells1.Print(Job, True);
end;

TPrintWhat: pwSelection, pwActiveSheets, pwEntireWorkbook.


Workflow 2 — Print area and repeating titles from selection

  1. Select the block that should print (and/or title rows/cols).
  2. Apply print area / titles from that selection.
  3. Preview to confirm page breaks.
{ Selection is 0-based col/row on the control }
MagiXells1.SelectRange(0, 0, 5, 40);   { A1:F41 }
MagiXells1.SetPrintAreaFromSelection;
MagiXells1.SetPrintTitlesFromSelection;
MagiXells1.PrintPreview;
{ MagiXells1.ClearPrintArea; }

SheetAPI alternative (A1 strings)

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.SetPrintArea('A1:F41');
  MagiXells1.PrintPreview;
  S.ClearPrintArea;
end;

Workflow 3 — Programmatic job without UI selection

Useful when a report button always prints a fixed region:

uses
  MagiXells.PageSetup;

var
  Job: TPrintJobSettings;
begin
  MagiXells1.Workbook.UseActiveSheet.SetPrintArea('A1:G50');

  Job := TPrintJobSettings.Default;
  Job.What := pwActiveSheets;
  Job.Copies := 2;
  MagiXells1.PrintPreview(Job);
  if MessageDlg('Send to printer?', mtConfirmation, [mbYes, mbNo], 0) = mrYes then
    MagiXells1.Print(Job, False);  { no extra dialog if you already confirmed }
end;

Tips


See also

RTL and themes

Sheet right-to-left layout and host UI chrome (Appearance). Sheet RTL is a workbook/sheet concern; Appearance / presets are host chrome (selection, headers, tabs, editors, chart series) and are distinct from the workbook OOXML theme.

Full property lists: Host options & UiTheme API.


Workflow 1 — Enable sheet RTL for BiDi editing

  1. Toggle RTL on the active sheet (control property or SheetAPI).
  2. Load or type RTL text; verify caret, alignment, and grid painting.
  3. Optionally match host chrome to a dark/light preset for your locale UI.
{ Control façade — active sheet }
MagiXells1.SheetRightToLeft := True;

{ SheetAPI — same effect on the authoring sheet }
MagiXells1.Workbook.UseActiveSheet.SetRtl(True);

{ Turn off later }
MagiXells1.SheetRightToLeft := False;

Load Arabic/RTL sample workbooks from the product samples folder (for example ARAB.mgx, RTL - Table.xlsx) to verify BiDi painting and editing.

AI: prompt “Turn on right-to-left for this sheet” → tool set_rtl.


Workflow 2 — Apply a UI theme preset (design-time or code)

Host chrome is Appearance: TMagiXellsUiTheme.

Design-time: select the MagiXells control → expand Appearance in the Object Inspector → set Preset. Presets are stored in the DFM/FMX (default Excel Light).

Preset Look
utpExcelLight Default Office-like light chrome
utpExcelDark Office Black (near-black chrome, white sheet)
utpExcelDarkGray Office Dark Gray (medium charcoal chrome, white sheet)
MagiXells brand helpers ApplyMagiXellsBrand etc. on the theme object
uses
  MagiXells.UiTheme;

MagiXells1.Appearance.Preset := utpExcelDarkGray;
{ or }
MagiXells1.Appearance.ApplyPreset(utpExcelDark);
{ or ApplyExcelLight / ApplyExcelDark / ApplyExcelDarkGray / ApplyMagiXellsBrand }

You can then override individual properties after the preset.


Workflow 3 — Batch custom chrome colors

Use BeginUpdate / EndUpdate so the grid does not repaint on every property:

MagiXells1.Appearance.BeginUpdate;
try
  MagiXells1.Appearance.SheetBackground := $00FFFFFF;
  MagiXells1.Appearance.SelectionBorder := $00595959;
  MagiXells1.Appearance.ActiveCellBorder := $00467321;
  MagiXells1.Appearance.ActiveCellBorderWidth := 2;
  MagiXells1.Appearance.HeaderBackground := $00F0F0F0;
  MagiXells1.Appearance.ChartSeries1 := $4472C4;
finally
  MagiXells1.Appearance.EndUpdate;
end;

Colors are TColor (COLORREF / BGR $00BBGGRR). For FMX surfaces use ColorRefToARGB when bridging to TAlphaColor.


Workflow 4 — Quick view colors (grid / freeze)

Independent of full UI presets — useful for subtle grid tweaks:

MagiXells1.ViewOptions.GridLineColor := $00D0D0D0;
MagiXells1.ViewOptions.FreezeLineColor := $00808080;

Combine with RTL:

MagiXells1.SheetRightToLeft := True;
MagiXells1.Appearance.ApplyPreset(utpExcelLight);
MagiXells1.ViewOptions.GridLineColor := $00C8C8C8;

See also

AI agent guide

MagiXells ships the agent API; you own the chat UI (or use optional AI chat packages / demo panels).

Minimal VCL setup

uses
  MagiXells.AI.Types, MagiXells.AI.Agent, MagiXells.AI.Host.Vcl;

var
  Config: TMagiXellsAIConfig;
  Agent: TMagiXellsAIAgent;
begin
  Config := TMagiXellsAIConfig.Default;
  Config.Provider := aipOpenAICompatible; // or aipAnthropic
  Config.BaseUrl := 'https://api.openai.com/v1';
  Config.ApiKey := GetEnvironmentVariable('MAGIXELLS_AI_API_KEY');
  Config.Model := 'gpt-4o-mini';

  Agent := TMagiXellsAIAgent.Create(Config);
  try
    Agent.Host := TMagiXellsAIHost.Create(MagiXells1);
    Agent.OnMessage := MagiXells1Message;
    Agent.OnStatus := MagiXells1Status;
    Agent.OnToolCall := MagiXells1ToolCall;
    Agent.OnFinished := MagiXells1Finished;
    Agent.RunAsync('Build a one-page sales summary with a column chart');
  finally
    // keep Agent alive until OnFinished if using RunAsync from a field
  end;
end;

FMX: use MagiXells.AI.Host.Fmx and TFmxMagiXellsAIHost.Create(FmxMagiXells1).

C++Builder: same types via .hpp includes — see C++Builder — AI agent. Ask the agent for C++ Builder code to rebuild a sheet (export_sheet_cppbuilder).

Run vs RunAsync

Method Behavior
Run Blocking on the calling thread (can freeze UI)
RunAsync HTTP on a worker; tools/UI events on the main thread; OnFinished on main
Cancel Request cancellation of an in-flight run

Configuration tips

Config.MaxToolRounds := 40;
Config.TimeoutMs := 120000;
Config.Temperature := 0.2;
Config.MaxTokens := 0; // auto from model context
Config.ReasoningEffort := ''; // or none|low|medium|high for compatible APIs
Agent.UpdateConfig(Config);

List models from the server:

var
  Models: TArray<string>;
  I: Integer;
begin
  Models := Agent.ListModels;
  for I := 0 to High(Models) do
    cbModel.Items.Add(Models[I]);
end;

Demo settings

Copy ai-settings.ini.example from the product demos folder next to your EXE as ai-settings.ini, or set:

Sample chat UI: product demos → View → AI Agent. Chat colors are TMagiXellsAIChatTheme (optional AI packages / demo panel) — they are not stored on TMagiXells.Appearance.

Tools

The agent exposes dozens of tools (get_range, set_cells, insert_chart, …). Mutations go through undo commands. Full catalog: AI agent API.

Confirm dangerous tools (optional)

function TForm1.AgentConfirmTool(Sender: TObject; const AToolName,
  AArgumentsJson: string): Boolean;
begin
  Result := MessageDlg('Allow tool ' + AToolName + '?', mtConfirmation,
    [mbYes, mbNo], 0) = mrYes;
end;

Agent.OnConfirmTool := AgentConfirmTool;

See also

C++Builder

MagiXells is implemented in Delphi and ships as RAD Studio packages. C++Builder (VCL and FMX) consumes the same Public/Published API through generated .hpp headers. There is no separate C++ MagiXells library.

Delphi class helpers (for example TWorksheet.Cell['A1'] and TWorkbook.UseActiveSheet) do not appear in C++. Prefer TSheetCellRef::Create, TSheetRangeRef::Create, and TAuthoringSheet::Create — the same surface the AI export_sheet_cppbuilder tool emits.

Prerequisites

Install packages for C++Builder

  1. Close the IDE.
  2. Run MagiXells-Trial-Setup.exe or MagiXells-Runtime-Setup.exe.
  3. Restart RAD Studio.
  4. In a C++Builder VCL or FMX project, confirm TMagiXells / TFmxMagiXells appear on the MagiXells palette.

Project settings (typical)

Drop a control (VCL)

  1. New C++Builder VCL Application.
  2. Drop TMagiXells from the MagiXells palette; set Align = alClient.
#include <MagiXells.Spreadsheet.hpp>

void __fastcall TForm1::FormCreate(TObject *Sender)
{
  MagiXells1->Align = alClient;
  MagiXells1->NewWorkbook();
}

Drop a control (FMX)

#include <MagiXells.Spreadsheet.Fmx.hpp>

void __fastcall TForm1::FormCreate(TObject *Sender)
{
  FmxMagiXells1->Align = TAlignLayout::Client;
  FmxMagiXells1->NewWorkbook();
}

Load and save

MagiXells1->LoadFromFile(L"C:\\Data\\report.xlsx");
MagiXells1->SaveToFile(L"C:\\Data\\report.mgx");

Streams (explicit format):

#include <MagiXells.Types.hpp>
#include <System.Classes.hpp>

void SaveAndReloadXlsx(TMagiXells *Grid)
{
  auto *MS = new TMemoryStream();
  try {
    Grid->SaveToStream(MS, TMagiXellsFileFormat::ffXlsx);
    MS->Position = 0;
    Grid->LoadFromStream(MS, TMagiXellsFileFormat::ffXlsx);
  } __finally {
    delete MS;
  }
}

Enum spelling in C++ follows the generated header (ffXlsx, sometimes scoped as TMagiXellsFileFormat::ffXlsx depending on RAD Studio / HPP style). Use Code Completion on TMagiXellsFileFormat.

Control API (selection-based)

Same Public methods as Delphi; use -> and C++ literals:

MagiXells1->SelectRange(0, 0, 2, 0); // A1:C1 (0-based)
MagiXells1->SetNumberFormat(L"0.00");
MagiXells1->MergeCells();

if (MagiXells1->CanUndo)
  MagiXells1->Undo();

MagiXells1->Behavior->AllowEdit = true;
MagiXells1->Zoom = 120;
MagiXells1->SheetRightToLeft = false;

Events

Wire in the Object Inspector or assign in code:

void __fastcall TForm1::MagiXells1SelectionChanged(TObject *Sender)
{
  Caption = Format(L"Col=%d Row=%d",
    ARRAYOFCONST((MagiXells1->ActiveCol, MagiXells1->ActiveRow)));
}

// FormCreate:
MagiXells1->OnSelectionChanged = MagiXells1SelectionChanged;

Active-cell gate:

void __fastcall TForm1::MagiXells1ActiveCellChanging(TObject *Sender,
  int ACol, int ARow, bool &Allow)
{
  Allow = ARow >= 1; // lock header row
}

Full event list: TMagiXells API (Delphi signatures; C++ uses the generated method-pointer types).

SheetAPI without class helpers

#include <MagiXells.SheetAPI.hpp>
#include <MagiXells.SheetAPI.Colors.hpp>

void FillDemo(TMagiXells *Grid)
{
  TWorksheet *Sheet = Grid->ActiveSheet;

  {
    TSheetCellRef C = TSheetCellRef::Create(Sheet, L"A1");
    C.Text = L"Hello";
    C.FontBold = true;
    C.FontSize = 14;
  }

  {
    TSheetCellRef C = TSheetCellRef::Create(Sheet, L"B1");
    C.AsNumber = 42;
  }

  {
    TSheetCellRef C = TSheetCellRef::Create(Sheet, L"C1");
    C.Formula = L"=B1*2";
  }

  TSheetRangeRef::Create(Sheet, L"A1:C1").BorderAround(TBorderLineStyle::blsThin);

  Grid->Recalculate();
}

Authoring sheet façade

TAuthoringSheet S = TAuthoringSheet::Create(Grid->Workbook, Grid->ActiveSheet);
TSheetCellRef C = TSheetCellRef::Create(S.Sheet, L"A2");
C.Text = L"Via TAuthoringSheet";
// Charts, tables, validation, etc. — same Public methods as Delphi SheetAPI:
// S.AddChart(...); S.AddTable(...); S.SetPrintArea(...);
Delphi (helpers OK) C++Builder
Sheet.Cell['A1'].Text := ... TSheetCellRef::Create(Sheet, L"A1").Text = ...
Sheet.Range['A1:B2'].Merge TSheetRangeRef::Create(Sheet, L"A1:B2").Merge()
Workbook.UseActiveSheet TAuthoringSheet::Create(Workbook, ActiveSheet)
Workbook.Names.Define(...) TWorkbookNamesFacade::Create(Workbook).Define(...)

See SheetAPI for the full Public member list.

Formulas and named ranges

MagiXells1->NamedRanges->AddOrSet(L"TaxRate", L"0.2");

TSheetCellRef C = TSheetCellRef::Create(MagiXells1->ActiveSheet, L"B1");
C.Formula = L"=1000*TaxRate";
MagiXells1->Recalculate();

AI agent (VCL)

#include <MagiXells.AI.Types.hpp>
#include <MagiXells.AI.Agent.hpp>
#include <MagiXells.AI.Host.Vcl.hpp>

void __fastcall TForm1::StartAgent()
{
  TMagiXellsAIConfig Config = TMagiXellsAIConfig::Default();
  Config.Provider = TMagiXellsAIProvider::aipOpenAICompatible;
  Config.BaseUrl = L"https://api.openai.com/v1";
  Config.ApiKey = GetEnvironmentVariable(L"MAGIXELLS_AI_API_KEY");
  Config.Model = L"gpt-4o-mini";

  // Keep Agent as a form field for RunAsync lifetime
  FAgent = new TMagiXellsAIAgent(Config);
  FAgent->Host = new TMagiXellsAIHost(MagiXells1);
  FAgent->OnMessage = AgentMessage;
  FAgent->OnFinished = AgentFinished;
  FAgent->RunAsync(L"Create a sales table with totals and a column chart");
}

FMX: #include <MagiXells.AI.Host.Fmx.hpp> and new TFmxMagiXellsAIHost(FmxMagiXells1).

Ask the agent for C++ Builder source to rebuild a sheet — it calls export_sheet_cppbuilder (see AI agent API).

Delphi ↔︎ C++ quick map

Delphi C++Builder
uses MagiXells.Spreadsheet #include <MagiXells.Spreadsheet.hpp>
MagiXells1.LoadFromFile(...) MagiXells1->LoadFromFile(...)
Align := alClient Align = alClient
'text' L"text" / UnicodeString
True / False true / false
try … finally try { … } __finally { … }
procedure … of object void __fastcall … method pointer
nested options Behavior.AllowEdit Behavior->AllowEdit

Demos

After install, open the VCL/FMX demos from Start Menu → Binary Magic → MagiXells. Use them as behavioral reference when writing a C++Builder host.

See also

Formulas overview

MagiXells includes an Excel-oriented formula engine with a dependency graph, ~500 builtins, dynamic arrays, and LAMBDA/LET family support.

This page is a capability overview, not a full Excel function encyclopedia. Prefer Excel documentation for individual function semantics; MagiXells aims for compatible behavior. For recalc, named ranges, and evaluator details see Formulas guide.


Using formulas from code

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].AsNumber := 10;
  S.Cell['A2'].Formula := '=A1*2';
  MagiXells1.Recalculate;
end;

Evaluate without writing a cell:

var
  V: TCellValue;
begin
  V := MagiXells1.Evaluator.Evaluate('=SUM(A1:A10)');
  ShowMessage(V.ToDisplayString);
end;

Named ranges:

MagiXells1.NamedRanges.AddOrSet('Rate', '0.08');
S.Cell['B1'].Formula := '=1000*Rate';
MagiXells1.Recalculate;

AI: tools evaluate_formula, explain_formula, list_formula_errors — see AI agent API.


Categories (representative)

Each category keeps a short example list, plus one worked SheetAPI snippet.

Math / trig

Examples: SUM, AVERAGE, ROUND, ABS, POWER, MOD, PI, SQRT

S.Cell['A1'].AsNumber := 2.4;
S.Cell['A2'].AsNumber := 3.6;
S.Cell['B1'].Formula := '=ROUND(SUM(A1:A2), 0)';  { 6 }
MagiXells1.Recalculate;

Statistical

Examples: MIN, MAX, STDEV, MEDIAN, COUNT, COUNTA, COUNTIF

S.Cell['A1'].AsNumber := 10;
S.Cell['A2'].AsNumber := 20;
S.Cell['A3'].AsNumber := 30;
S.Cell['B1'].Formula := '=AVERAGE(A1:A3)';
S.Cell['B2'].Formula := '=COUNTIF(A1:A3,">15")';  { 2 }
MagiXells1.Recalculate;

Logical

Examples: IF, AND, OR, NOT, IFS, IFERROR, IFNA

S.Cell['A1'].AsNumber := 0;
S.Cell['B1'].Formula := '=IFERROR(1/A1, "n/a")';
S.Cell['B2'].Formula := '=IF(AND(A1>=0, A1<100), "ok", "out")';
MagiXells1.Recalculate;

Text

Examples: LEFT, RIGHT, MID, LEN, TRIM, UPPER, LOWER, TEXT, VALUE

S.Cell['A1'].Text := '  magixells  ';
S.Cell['B1'].Formula := '=UPPER(TRIM(A1))';  { MAGIXELLS }
S.Cell['B2'].Formula := '=LEFT(B1, 4)';     { MAGI }
MagiXells1.Recalculate;

Lookup / ref

Examples: VLOOKUP, HLOOKUP, INDEX, MATCH, XLOOKUP, ADDRESS, INDIRECT, OFFSET

S.Cell['A1'].Text := 'Code';
S.Cell['B1'].Text := 'Name';
S.Cell['A2'].Text := 'W1';
S.Cell['B2'].Text := 'Widget';
S.Cell['A3'].Text := 'G1';
S.Cell['B3'].Text := 'Gadget';
S.Cell['D1'].Text := 'W1';
S.Cell['E1'].Formula := '=XLOOKUP(D1, A2:A3, B2:B3)';  { Widget }
MagiXells1.Recalculate;

Date / time

Examples: TODAY, NOW, DATE, YEAR, MONTH, DAY, EOMONTH, NETWORKDAYS

S.Cell['A1'].Formula := '=DATE(2026, 9, 5)';
S.Cell['B1'].Formula := '=EOMONTH(A1, 0)';
S.Cell['C1'].Formula := '=NETWORKDAYS(A1, B1)';
MagiXells1.Recalculate;

Financial

Examples: PMT, FV, PV, NPER, RATE, NPV, IRR

{ Loan: 5% annual, 60 months, $10,000 principal }
S.Cell['A1'].Formula := '=PMT(0.05/12, 60, -10000)';
MagiXells1.Recalculate;

Information

Examples: ISBLANK, ISNUMBER, ISTEXT, ISERROR, TYPE

S.Cell['A1'].Text := 'x';
S.Cell['B1'].Formula := '=IF(ISNUMBER(A1), A1, VALUE("0"))';
S.Cell['B2'].Formula := '=ISTEXT(A1)';  { TRUE }
MagiXells1.Recalculate;

Dynamic arrays

Examples: FILTER, SEQUENCE, UNIQUE, SORT, SORTBY, TRANSPOSE, HSTACK, VSTACK, TOROW, TOCOL, TAKE, DROP, EXPAND, RANDARRAY, GROUPBY, PIVOTBY

S.Cell['D1'].Formula := '=SEQUENCE(5)';
MagiXells1.Recalculate;
{ D1:D5 spill; conflicts surface as #SPILL! }
S.Cell['A1'].Text := 'Region';
S.Cell['B1'].Text := 'Amt';
S.Cell['A2'].Text := 'East';
S.Cell['B2'].AsNumber := 10;
S.Cell['A3'].Text := 'West';
S.Cell['B3'].AsNumber := 20;
S.Cell['A4'].Text := 'East';
S.Cell['B4'].AsNumber := 5;
S.Cell['D1'].Formula := '=UNIQUE(A2:A4)';
MagiXells1.Recalculate;

Lambda family

Examples: LAMBDA, LET, MAP, BYROW, BYCOL, REDUCE, SCAN, MAKEARRAY, ISOMITTED

S.Cell['A1'].AsNumber := 2;
S.Cell['A2'].AsNumber := 3;
S.Cell['B1'].Formula := '=LET(x, A1, y, A2, x*y+1)';  { 7 }
S.Cell['B2'].Formula := '=MAP(A1:A2, LAMBDA(v, v*10))';
MagiXells1.Recalculate;

Pivot / cube

Examples: GETPIVOTDATA, FIELDVALUE, CUBEVALUE, CUBEMEMBER, …

{ After a pivot exists with values at E1 — see guide-pivots.md }
S.Cell['G1'].Formula := '=GETPIVOTDATA("Amount",$E$1,"Region","East")';
MagiXells1.Recalculate;

CUBE* needs a workbook connection (mock OLAP supported). See PivotTables.

Implicit intersection

@ prefix (e.g. @FILTER(...)) yields a scalar.

S.Cell['A1'].Formula := '=@SEQUENCE(5)';  { scalar from spill }
MagiXells1.Recalculate;

Dynamic arrays / spill

Spill formulas write into a spill range. Conflicts surface as #SPILL!.

S.Cell['D1'].Formula := '=SEQUENCE(5)';
MagiXells1.Recalculate;

Use MaterializeSpillAsTable on SheetAPI to convert a live spill into a sheet Table + AutoFilter after the fact (see web/import notes below).


Auto vs manual calculate

MagiXells1.Behavior.AutoCalculate := True;  // default
{ or batch edits: }
MagiXells1.Behavior.AutoCalculate := False;
{ … many cell writes … }
MagiXells1.Recalculate;

Show formulas

MagiXells1.ShowFormulas := True;

Web / RTD / stock / import

ENCODEURL, WEBSERVICE, FILTERXML, IMPORTHTML, IMPORTDATA, IMPORTXML, IMPORTFEED, IMPORTRANGE, GOOGLEFINANCE, GOOGLETRANSLATE / TRANSLATE, DETECTLANGUAGE, STOCKHISTORY, and RTD are implemented. Host apps can supply providers on TMagiXells (StockHistoryProvider, RtdProvider, GoogleFinanceProvider, TranslateProvider, ImportRangeProvider). Default STOCKHISTORY / GOOGLEFINANCE (common attributes) use Yahoo Finance; RTD falls back to Windows COM; translate / IMPORTRANGE need a host provider (#N/A otherwise). IMPORTHTML accepts optional MagiXells trailing args: a GVQL filter/sort string and/or TRUE to materialize as a sheet Table + AutoFilter (Google’s 3-arg form still works).

Also: REGEXEXTRACT / REGEXREPLACE / REGEXMATCH / REGEXTEST, ISEMAIL, ISURL, JOIN, ARRAY_CONSTRAIN, and QUERY (Google Visualization Query Language subset).

S.Cell['A1'].Formula := '=ENCODEURL("a b")';
S.Cell['A2'].Text := 'user@example.com';
S.Cell['B2'].Formula := '=ISEMAIL(A2)';
MagiXells1.Recalculate;

Still #N/A (not yet)

CALL, REGISTER.ID, PYTHON, locale/DBCS helpers, AGGREGATE, CELL, FORECAST.ETS*, FINV / BETA.INV, IMAGE, etc.


See also

API reference index

Only Public and Published members are documented. Developers on Trial/Runtime installs have no library source — docs must stand alone.

Member page pattern

Every constant, type, property, method, and event uses this shape (see types.md for the reference quality bar):

### MemberName
**Visibility:** public | published
**Declaration**

```delphi {.declaration}

```

```cpp {.declaration}

```
**Where used:** When/why a host needs this (scenario, pitfalls, related APIs).

**How to use:**

```delphi
{ Concrete snippet a developer can paste — not only MagiXells1.Foo; }
```

Declarations use DocWiki-style Delphi and C++ fences ({.declaration}). How to use samples stay Delphi-first; for C++ call shapes and SheetAPI without helpers, see C++Builder. - Prefer 1-based core addresses (TCellAddress) and A1 + SheetAPI in samples unless the API is explicitly 0-based. - Mention C++Builder when the call shape differs; otherwise link C++Builder. - Group related members, but do not skip Where/How on individual members.

Controls

Core types

Host configuration

Programmatic authoring

AI

TMagiXells / TFmxMagiXells

Drop-in spreadsheet control for host applications. The VCL and FMX classes share the same MagiXells workbook model; chrome and layout differ by framework.

VCL FMX
Class TMagiXells TFmxMagiXells
Unit MagiXells.Spreadsheet MagiXells.Spreadsheet.Fmx
Ancestor TCustomControl TControl

Trial / Runtime: Installs ship compiled packages only (no library .pas). This page is the public contract for hosts without source. Prefer A1 + SheetAPI for cell authoring; use control methods for selection, chrome, I/O, and UI events. Shared types: MagiXells.Types. Formats: Import / export. Host option objects: Host options & UiTheme.

Examples use MagiXells1: TMagiXells (Delphi). For FMX, use FmxMagiXells1: TFmxMagiXells — MagiXells members match unless a VCL/FMX note says otherwise. C++Builder: C++Builder (->, .hpp, no class helpers).

Convention: Cell column/row indexes on this control (SelectCell, SelectRange, ActiveCol/ActiveRow, DeleteRows/InsertColumns, event Col/Row) are 1-based (column 1 = A, row 1 = first row), matching Excel and TCellAddress. Sheet indexes (ActiveSheetIndex, RemoveSheet, …) are 0-based.

uses
  MagiXells.Types,
  MagiXells.Spreadsheet,   { or MagiXells.Spreadsheet.Fmx }
  MagiXells.SheetAPI;

begin
  MagiXells1.NewWorkbook;
  MagiXells1.Workbook.UseActiveSheet.Cell['A1'].Text := 'Hello';
  MagiXells1.SelectCell(1, 1);  { A1 — 1-based }
  MagiXells1.SaveToFile('C:\Data\demo.mgx');
end;

Lifetime

Create

Visibility: public
Declaration

Delphi
constructor Create(AOwner: TComponent); override;
C++
__fastcall Create(System::Classes::TComponent* AOwner)/* override */;

Where used: Create the control at runtime (not dropped from the palette). Owner frees it with the form/frame.

How to use:

{ VCL }
MagiXells1 := TMagiXells.Create(Self);
MagiXells1.Parent := Self;
MagiXells1.Align := alClient;

{ FMX }
FmxMagiXells1 := TFmxMagiXells.Create(Self);
FmxMagiXells1.Parent := Self;
FmxMagiXells1.Align := TAlignLayout.Client;

Destroy

Visibility: public
Declaration

Delphi
destructor Destroy; override;
C++
__fastcall ~Destroy();/* override */

Where used: Explicit teardown when the control has no owner, or before replacing an instance. Prefer letting AOwner free it.

How to use:

MagiXells1.Free;  { or FreeAndNil(MagiXells1) }

GetChildren

Visibility: public (VCL)
Declaration

Delphi
procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
C++
void __fastcall GetChildren(
  TGetChildProc Proc,
  System::Classes::TComponent* Root
)/* override */;

Where used: Streaming / designer. MagiXells overrides this so formula bar, grid, and sheet tabs stay subcomponents, not form children (avoids DFM grab-handle issues). Hosts almost never call this.

How to use:

{ Do not stream inner chrome as owned form controls — leave the override alone. }

SetFocus

Visibility: public (VCL)
Declaration

Delphi
procedure SetFocus; override;
C++
void __fastcall SetFocus()/* override */;

Where used: Moves keyboard focus to the grid sheet, not the formula bar. Click the formula bar to edit there. FMX uses the normal TControl focus path on the composite.

How to use:

MagiXells1.SetFocus;  { sheet receives keys }

Workbook I/O

NewWorkbook

Visibility: public
Declaration

Delphi
procedure NewWorkbook;
C++
void __fastcall NewWorkbook();

Where used: Start a blank workbook (File → New). Discards the current in-memory book — prompt to save first if Modified.

How to use:

if MagiXells1.IsModified then
  if MessageDlg('Save changes?', mtConfirmation, [mbYes, mbNo], 0) = mrYes then
    MagiXells1.SaveToFile(CurrentPath);
MagiXells1.NewWorkbook;

LoadFromFile

Visibility: public
Declaration

Delphi
procedure LoadFromFile(const AFileName: string);
C++
void __fastcall LoadFromFile(const System::UnicodeString AFileName);

Where used: Open .mgx, .xlsx/.xlsm, .ods, or .csv by extension (ffAuto). Large files report via OnProgress. See Import / export.

How to use:

MagiXells1.LoadFromFile('C:\Data\report.xlsx');
Caption := MagiXells1.ActiveSheet.Name;

SaveToFile

Visibility: public
Declaration

Delphi
procedure SaveToFile(const AFileName: string);
C++
void __fastcall SaveToFile(const System::UnicodeString AFileName);

Where used: Persist the workbook; extension selects format. A .pdf path is an export convenience — prefer ExportToPdf for PDF jobs.

How to use:

MagiXells1.SaveToFile('C:\Data\report.mgx');
MagiXells1.SaveToFile('C:\Data\report.xlsx');

LoadFromStream

Visibility: public
Declaration

Delphi
procedure LoadFromStream(AStream: TStream; const AFormat: TMagiXellsFileFormat);
C++
void __fastcall LoadFromStream(
  System::Classes::TStream* AStream,
  const TMagiXellsFileFormat AFormat
);

Where used: Load from memory, blobs, or resources with no file extension. Streams require an explicit TMagiXellsFileFormat (ffAuto is not enough).

How to use:

uses MagiXells.Types, System.Classes;

procedure LoadXlsxBytes(AGrid: TMagiXells; const ABytes: TBytes);
var
  MS: TMemoryStream;
begin
  MS := TMemoryStream.Create;
  try
    if Length(ABytes) > 0 then
      MS.WriteBuffer(ABytes[0], Length(ABytes));
    MS.Position := 0;
    AGrid.LoadFromStream(MS, ffXlsx);
  finally
    MS.Free;
  end;
end;

SaveToStream

Visibility: public
Declaration

Delphi
procedure SaveToStream(AStream: TStream; const AFormat: TMagiXellsFileFormat);
C++
void __fastcall SaveToStream(
  System::Classes::TStream* AStream,
  const TMagiXellsFileFormat AFormat
);

Where used: Serialize without touching disk (upload, tests). Pass ffMgx / ffXlsx / ffOds / ffCsv explicitly.

How to use:

var MS: TMemoryStream;
begin
  MS := TMemoryStream.Create;
  try
    MagiXells1.SaveToStream(MS, ffOds);
    MS.Position := 0;
    { upload MS }
  finally
    MS.Free;
  end;
end;

ExportToPdf

Visibility: public
Declaration

Delphi
procedure ExportToPdf(const AFileName: string); overload;
C++
void __fastcall ExportToPdf(const System::UnicodeString AFileName) /* overload */;

Where used: One-shot PDF using default print-job settings. Does not replace the workbook file.

How to use:

MagiXells1.ExportToPdf('C:\Data\report.pdf');

ExportToPdf (job)

Visibility: public
Declaration

Delphi
procedure ExportToPdf(const AFileName: string; const AJob: TPrintJobSettings); overload;
C++
void __fastcall ExportToPdf(
  const System::UnicodeString AFileName,
  const TPrintJobSettings AJob
) /* overload */;

Where used: PDF with explicit print scope (selection / sheet / workbook) and page options.

How to use:

var Job: TPrintJobSettings;
begin
  Job := TPrintJobSettings.Default;
  Job.What := pwEntireWorkbook;
  MagiXells1.ExportToPdf('C:\Data\book.pdf', Job);
end;

ExportToCsv

Visibility: public
Declaration

Delphi
procedure ExportToCsv(const AFileName: string); overload;
C++
void __fastcall ExportToCsv(const System::UnicodeString AFileName) /* overload */;

Where used: Quick CSV of the active sheet with default options.

How to use:

MagiXells1.ExportToCsv('C:\Data\sheet.csv');

ExportToCsv (options)

Visibility: public
Declaration

Delphi
procedure ExportToCsv(const AFileName: string; const AOptions: TCsvExportOptions); overload;
C++
void __fastcall ExportToCsv(
  const System::UnicodeString AFileName,
  const TCsvExportOptions AOptions
) /* overload */;

Where used: Custom delimiter, selection-only export, etc. (MagiXells.IO.Csv). See guide-io.

How to use:

uses MagiXells.IO.Csv;
var Opt: TCsvExportOptions;
begin
  Opt := TCsvExportOptions.Default;
  Opt.Delimiter := ';';
  Opt.What := pwSelection;
  MagiXells1.SelectRange(TCellRange.FromA1('A1:C20'));
  MagiXells1.ExportToCsv('C:\Data\selection.csv', Opt);
end;

Recalculate

Visibility: public
Declaration

Delphi
procedure Recalculate;
C++
void __fastcall Recalculate();

Where used: Force a full workbook formula pass after bulk programmatic edits, or when Behavior.AutoCalculate is off. Same engine as Evaluator.RecalculateAll.

How to use:

MagiXells1.BeginUpdate;
try
  MagiXells1.Workbook.UseActiveSheet.Cell['A1'].AsNumber := 10;
  MagiXells1.Workbook.UseActiveSheet.Cell['A2'].Formula := '=A1*2';
finally
  MagiXells1.EndUpdate;
end;
MagiXells1.Recalculate;

IsModified

Visibility: public
Declaration

Delphi
function IsModified: Boolean;
C++
bool __fastcall IsModified();

Where used: Dirty check before close / navigation. Same flag as published Modified.

How to use:

if MagiXells1.IsModified then
  MagiXells1.SaveToFile(Path);

BeginUpdate

Visibility: public
Declaration

Delphi
procedure BeginUpdate; { FMX: reintroduce }
C++
void __fastcall BeginUpdate(); /* FMX: reintroduce */

Where used: Nesting-safe batch. While locked: paints deferred; formula auto-calc / live charts deferred; auto row-height skipped; OnModified deferred (workbook still marks modified). Always pair with EndUpdate in try/finally.

How to use:

MagiXells1.BeginUpdate;

EndUpdate

Visibility: public
Declaration

Delphi
procedure EndUpdate; { FMX: reintroduce }
C++
void __fastcall EndUpdate(); /* FMX: reintroduce */

Where used: Ends the outer batch and flushes: full recalc (if Behavior.AutoCalculate), auto row heights, chart refresh, one grid repaint, then OnModified if needed.

How to use:

MagiXells1.BeginUpdate;
try
  { many SheetAPI / selection edits }
finally
  MagiXells1.EndUpdate;
end;

OnCellChanged is for interactive edits (inplace commit, fill, …). Programmatic SheetAPI / SetCell changes do not fire it. Selection and other events are not suppressed.


Protection

Protect

Visibility: public
Declaration

Delphi
procedure Protect;
C++
void __fastcall Protect();

Where used: Protect the active sheet (Worksheet.Protected := True). Combine with locked cells and Protection for host UI locks.

How to use:

MagiXells1.Protect;

Unprotect

Visibility: public
Declaration

Delphi
procedure Unprotect;
C++
void __fastcall Unprotect();

Where used: Clear active-sheet protection after an authorized host action (password UI is yours).

How to use:

MagiXells1.Unprotect;

ProtectStructure

Visibility: public
Declaration

Delphi
procedure ProtectStructure;
C++
void __fastcall ProtectStructure();

Where used: Lock workbook structure (add/delete/rename/reorder sheets). Sets Protection.ProtectStructure and Workbook.StructureProtected.

How to use:

MagiXells1.ProtectStructure;

UnprotectStructure

Visibility: public
Declaration

Delphi
procedure UnprotectStructure;
C++
void __fastcall UnprotectStructure();

Where used: Allow sheet structure changes again from code/UI.

How to use:

MagiXells1.UnprotectStructure;

Formatting (selection)

These apply to the current selection on the active sheet. Prefer SheetAPI when formatting by A1 without changing the user’s selection.

MergeCells

Visibility: public
Declaration

Delphi
procedure MergeCells;
C++
void __fastcall MergeCells();

Where used: Merge the selected rectangle (Excel-like). Select first, then merge.

How to use:

MagiXells1.SelectRange(1, 1, 3, 1);  { A1:C1 — 1-based }
MagiXells1.MergeCells;

UnmergeCells

Visibility: public
Declaration

Delphi
procedure UnmergeCells;
C++
void __fastcall UnmergeCells();

Where used: Split merges that intersect the selection.

How to use:

MagiXells1.SelectRange(TCellRange.FromA1('A1:C1'));
MagiXells1.UnmergeCells;

SetFont

Visibility: public
Declaration

Delphi
procedure SetFont(const AFont: TCellFontInfo);
C++
void __fastcall SetFont(const TCellFontInfo AFont);

Where used: Apply font fields to the selection (toolbar Bold/Italic, theme fonts).

How to use:

var F: TCellFontInfo;
begin
  F := MagiXells1.GetActiveCellFormat.Font;
  F.Name := 'Calibri';
  F.Size := 11;
  F.Bold := True;
  MagiXells1.SetFont(F);
end;

SetFill

Visibility: public
Declaration

Delphi
procedure SetFill(const AFill: TCellFillInfo);
C++
void __fastcall SetFill(const TCellFillInfo AFill);

Where used: Fill / highlight the selection.

How to use:

var Fill: TCellFillInfo;
begin
  Fill := Default(TCellFillInfo);
  Fill.PatternType := cfpSolid;
  Fill.FgColor.RGB := $00FFFFCC;
  MagiXells1.SetFill(Fill);
end;

SetBorder

Visibility: public
Declaration

Delphi
procedure SetBorder(const ABorder: TCellBorderInfo);
C++
void __fastcall SetBorder(const TCellBorderInfo ABorder);

Where used: Apply border sides/styles to the selection.

How to use:

var B: TCellBorderInfo;
begin
  B := Default(TCellBorderInfo);
  B.Left.Style := cbsThin;
  B.Right.Style := cbsThin;
  B.Top.Style := cbsThin;
  B.Bottom.Style := cbsThin;
  MagiXells1.SetBorder(B);
end;

SetAlignment

Visibility: public
Declaration

Delphi
procedure SetAlignment(const AAlign: TCellAlignmentInfo);
C++
void __fastcall SetAlignment(const TCellAlignmentInfo AAlign);

Where used: Horizontal/vertical align, wrap, indent on the selection.

How to use:

var A: TCellAlignmentInfo;
begin
  A := Default(TCellAlignmentInfo);
  A.Horizontal := haCenter;
  A.Vertical := vaCenter;
  A.WrapText := True;
  MagiXells1.SetAlignment(A);
end;

SetNumberFormat

Visibility: public
Declaration

Delphi
procedure SetNumberFormat(const AFormat: string);
C++
void __fastcall SetNumberFormat(const System::UnicodeString AFormat);

Where used: Excel-style number format codes on the selection (#,##0.00, yyyy-mm-dd, …).

How to use:

MagiXells1.SelectRange(TCellRange.FromA1('B2:B100'));
MagiXells1.SetNumberFormat('#,##0.00');

GetActiveCellFormat

Visibility: public
Declaration

Delphi
function GetActiveCellFormat: TCellFormat;
C++
TCellFormat __fastcall GetActiveCellFormat();

Where used: Sync a formatting ribbon/toolbar to the active cell.

How to use:

var Fmt: TCellFormat;
begin
  Fmt := MagiXells1.GetActiveCellFormat;
  actBold.Checked := Fmt.Font.Bold;
  edtNumFmt.Text := Fmt.NumberFormat;
end;

Clipboard

CopySelection

Visibility: public
Declaration

Delphi
procedure CopySelection;
C++
void __fastcall CopySelection();

Where used: Host Edit → Copy / Ctrl+C when MagiXells should own the clipboard.

How to use:

MagiXells1.CopySelection;

CutSelection

Visibility: public
Declaration

Delphi
procedure CutSelection;
C++
void __fastcall CutSelection();

Where used: Edit → Cut. Respects protection / Behavior.AllowCopy.

How to use:

MagiXells1.CutSelection;

PasteAll

Visibility: public
Declaration

Delphi
procedure PasteAll;
C++
void __fastcall PasteAll();

Where used: Full paste (values + formulas + formats) at the active cell / selection.

How to use:

MagiXells1.PasteAll;

PasteValues

Visibility: public
Declaration

Delphi
procedure PasteValues;
C++
void __fastcall PasteValues();

Where used: Paste values only (strip formulas).

How to use:

MagiXells1.PasteValues;

PasteFormulas

Visibility: public
Declaration

Delphi
procedure PasteFormulas;
C++
void __fastcall PasteFormulas();

Where used: Paste formulas (adjusted) without forcing all cosmetics.

How to use:

MagiXells1.PasteFormulas;

PasteFormats

Visibility: public
Declaration

Delphi
procedure PasteFormats;
C++
void __fastcall PasteFormats();

Where used: Paste formats only onto the selection.

How to use:

MagiXells1.PasteFormats;

Clear

ClearContents

Visibility: public
Declaration

Delphi
procedure ClearContents;
C++
void __fastcall ClearContents();

Where used: Clear Contents on the selection (keeps formats). Undoable.

How to use:

MagiXells1.SelectRange(TCellRange.FromA1('A1:C10'));
MagiXells1.ClearContents;

ClearFormats

Visibility: public
Declaration

Delphi
procedure ClearFormats;
C++
void __fastcall ClearFormats();

Where used: Strip formats from the selection; leave values/formulas.

How to use:

MagiXells1.ClearFormats;

ClearAll

Visibility: public
Declaration

Delphi
procedure ClearAll;
C++
void __fastcall ClearAll();

Where used: Clear both contents and formats on the selection.

How to use:

MagiXells1.ClearAll;

Rows / columns

Row/column start indexes are 1-based (AStart < 1 is ignored). ACount defaults to 1. Requires Behavior.AllowDelete / AllowInsert as appropriate.

DeleteRows

Visibility: public
Declaration

Delphi
procedure DeleteRows(AStartRow: Integer; ACount: Integer = 1);
C++
void __fastcall DeleteRows(int AStartRow, int ACount = 1);

Where used: Delete whole rows starting at a 1-based row.

How to use:

MagiXells1.DeleteRows(5, 2);  { delete rows 5 and 6 }

DeleteColumns

Visibility: public
Declaration

Delphi
procedure DeleteColumns(AStartCol: Integer; ACount: Integer = 1);
C++
void __fastcall DeleteColumns(int AStartCol, int ACount = 1);

Where used: Delete whole columns starting at a 1-based column (1 = A).

How to use:

MagiXells1.DeleteColumns(3, 1);  { delete column C }

InsertRows

Visibility: public
Declaration

Delphi
procedure InsertRows(AStartRow: Integer; ACount: Integer = 1);
C++
void __fastcall InsertRows(int AStartRow, int ACount = 1);

Where used: Insert blank rows before AStartRow (1-based).

How to use:

MagiXells1.InsertRows(2, 3);  { insert 3 rows above row 2 }

InsertColumns

Visibility: public
Declaration

Delphi
procedure InsertColumns(AStartCol: Integer; ACount: Integer = 1);
C++
void __fastcall InsertColumns(int AStartCol, int ACount = 1);

Where used: Insert blank columns before AStartCol (1-based).

How to use:

MagiXells1.InsertColumns(1, 1);  { insert a column before A }

DeleteSelectionRows

Visibility: public
Declaration

Delphi
procedure DeleteSelectionRows;
C++
void __fastcall DeleteSelectionRows();

Where used: Delete rows spanned by the current selection. No-ops for entire-column selections (use DeleteSelectionColumns).

How to use:

MagiXells1.SelectRange(TCellRange.FromA1('A5:C6'));
MagiXells1.DeleteSelectionRows;

DeleteSelectionColumns

Visibility: public
Declaration

Delphi
procedure DeleteSelectionColumns;
C++
void __fastcall DeleteSelectionColumns();

Where used: Delete columns spanned by the selection. No-ops for entire-row-only selections.

How to use:

MagiXells1.DeleteSelectionColumns;

InsertSelectionRows

Visibility: public
Declaration

Delphi
procedure InsertSelectionRows;
C++
void __fastcall InsertSelectionRows();

Where used: Insert as many rows as the selection height, at the selection’s start row.

How to use:

MagiXells1.InsertSelectionRows;

InsertSelectionColumns

Visibility: public
Declaration

Delphi
procedure InsertSelectionColumns;
C++
void __fastcall InsertSelectionColumns();

Where used: Insert as many columns as the selection width, at the selection’s start column.

How to use:

MagiXells1.InsertSelectionColumns;

Selection and editing

All cell coordinates below are 1-based.

SelectCell

Visibility: public
Declaration

Delphi
procedure SelectCell(ACol, ARow: Integer);
C++
void __fastcall SelectCell(int ACol, int ARow);

Where used: Move the active cell (and collapse the selection). Use for Go To, hyperlink navigation, and restoring a saved caret.

How to use:

MagiXells1.SelectCell(1, 1);   { A1 }
MagiXells1.SelectCell(2, 5);   { B5 }

SelectRange (TCellRange)

Visibility: public
Declaration

Delphi
procedure SelectRange(const ARange: TCellRange); overload;
C++
void __fastcall SelectRange(const TCellRange ARange) /* overload */;

Where used: Select a rectangle from a TCellRange (prefer FromA1 / Normalize).

How to use:

var R: TCellRange;
begin
  R := TCellRange.FromA1('A1:D6');
  MagiXells1.SelectRange(R);
  { or }
  MagiXells1.SelectRange(TCellRange.Create(1, 1, 4, 6));
end;

SelectRange (coords)

Visibility: public
Declaration

Delphi
procedure SelectRange(AStartCol, AStartRow, AEndCol, AEndRow: Integer); overload;
C++
void __fastcall SelectRange(
  int AStartCol,
  int AStartRow,
  int AEndCol,
  int AEndRow
) /* overload */;

Where used: Select by inclusive 1-based corners (order may be reversed; range is normalized).

How to use:

MagiXells1.SelectRange(1, 1, 4, 6);  { A1:D6 }

BeginEdit

Visibility: public
Declaration

Delphi
procedure BeginEdit(const AInitialText: string = '');
C++
void __fastcall BeginEdit(const System::UnicodeString AInitialText = L"");

Where used: Start inplace edit on the active cell. Optional seed text (e.g. start a formula). Blocked by OnBeforeEdit / protection / ReadOnly.

How to use:

MagiXells1.BeginEdit('=A1+1');

EndEdit

Visibility: public
Declaration

Delphi
procedure EndEdit;
C++
void __fastcall EndEdit();

Where used: Commit the current inplace / formula-bar edit.

How to use:

if MagiXells1.IsEditing then
  MagiXells1.EndEdit;

CancelEdit

Visibility: public
Declaration

Delphi
procedure CancelEdit;
C++
void __fastcall CancelEdit();

Where used: Abort the current edit without writing (Escape).

How to use:

MagiXells1.CancelEdit;

IsEditing

Visibility: public
Declaration

Delphi
function IsEditing: Boolean;
C++
bool __fastcall IsEditing();

Where used: True while inplace or formula-bar cell edit is active. Host shortcuts that mutate the sheet should no-op or commit first.

How to use:

if MagiXells1.IsEditing then
  MagiXells1.EndEdit;

IsFormulaBarFocused

Visibility: public
Declaration

Delphi
function IsFormulaBarFocused: Boolean;
C++
bool __fastcall IsFormulaBarFocused();

Where used: True while the caret is in the name box or formula field. Host Ctrl+B/I/U (and similar) should no-op so they do not restyle the whole cell.

How to use:

if MagiXells1.IsEditing or MagiXells1.IsFormulaBarFocused then
  Exit;

IsFormulaEditFocused

Visibility: public
Declaration

Delphi
function IsFormulaEditFocused: Boolean;
C++
bool __fastcall IsFormulaEditFocused();

Where used: True only while the formula field (not the name box) has edit focus. Narrower than IsFormulaBarFocused.

How to use:

if MagiXells1.IsFormulaEditFocused then
  StatusBar1.SimpleText := 'Editing formula';

ScrollToCell

Visibility: public
Declaration

Delphi
procedure ScrollToCell(ACol, ARow: Integer);
C++
void __fastcall ScrollToCell(int ACol, int ARow);

Where used: Scroll the viewport so the given 1-based cell is reachable (does not necessarily change selection).

How to use:

MagiXells1.ScrollToCell(1, 100);  { column A, row 100 }

EnsureSelectionVisible

Visibility: public
Declaration

Delphi
procedure EnsureSelectionVisible;
C++
void __fastcall EnsureSelectionVisible();

Where used: Scroll just enough so the active selection is on screen after programmatic select or layout changes.

How to use:

MagiXells1.SelectRange(TCellRange.FromA1('Z200'));
MagiXells1.EnsureSelectionVisible;

GetVisibleRange

Visibility: public
Declaration

Delphi
function GetVisibleRange: TVisibleRange;
C++
TVisibleRange* __fastcall GetVisibleRange();

Where used: On-screen bounding box (1-based cols/rows), including frozen panes. TVisibleRange has StartCol, EndCol, StartRow, EndRow (MagiXells.Grid.Types).

How to use:

var R: TVisibleRange;
begin
  R := MagiXells1.GetVisibleRange;
  Caption := Format('Visible %s%d:%s%d',
    [ColToLetters(R.StartCol), R.StartRow,
     ColToLetters(R.EndCol), R.EndRow]);
end;

GetScrollableVisibleRange

Visibility: public
Declaration

Delphi
function GetScrollableVisibleRange: TVisibleRange;
C++
TVisibleRange* __fastcall GetScrollableVisibleRange();

Where used: Visible cells in the unfrozen / scrollable pane only. Compare with GetVisibleRange when frozen rows/cols are set.

How to use:

var S: TVisibleRange;
begin
  S := MagiXells1.GetScrollableVisibleRange;
end;

GetDefaultFont

Visibility: public
Declaration

Delphi
function GetDefaultFont: TCellFontInfo;
C++
TCellFontInfo __fastcall GetDefaultFont();

Where used: Read the workbook Normal style as TCellFontInfo (includes color on both VCL and FMX). Prefer this when FMX TFont has no color.

How to use:

var Info: TCellFontInfo;
begin
  Info := MagiXells1.GetDefaultFont;
end;

SetDefaultFont

Visibility: public
Declaration

Delphi
procedure SetDefaultFont(const AFont: TCellFontInfo);
C++
void __fastcall SetDefaultFont(const TCellFontInfo AFont);

Where used: Write the workbook Normal style from TCellFontInfo. Re-apply after NewWorkbook / load if you need a non-default Normal font.

How to use:

var Info: TCellFontInfo;
begin
  Info := MagiXells1.GetDefaultFont;
  Info.Name := 'Consolas';
  Info.Size := 10;
  MagiXells1.SetDefaultFont(Info);
end;

Sheets

Sheet indexes are 0-based. Visibility uses TSheetVisibility.

AddSheet

Visibility: public
Declaration

Delphi
function AddSheet(const AName: string = ''): TWorksheet;
C++
TWorksheet* __fastcall AddSheet(const System::UnicodeString AName = L"");

Where used: Append a worksheet. Empty name auto-generates. Blocked when structure-protected.

How to use:

var Ws: TWorksheet;
begin
  Ws := MagiXells1.AddSheet('Sales');
  MagiXells1.ActiveSheetIndex := MagiXells1.SheetCount - 1;
end;

RemoveSheet

Visibility: public
Declaration

Delphi
procedure RemoveSheet(AIndex: Integer);
C++
void __fastcall RemoveSheet(int AIndex);

Where used: Delete sheet by 0-based index. Cannot remove the last sheet; respect structure protection.

How to use:

MagiXells1.RemoveSheet(1);  { second sheet }

RenameSheet

Visibility: public
Declaration

Delphi
procedure RenameSheet(AIndex: Integer; const AName: string);
C++
void __fastcall RenameSheet(int AIndex, const System::UnicodeString AName);

Where used: Rename sheet by 0-based index (unique name rules apply).

How to use:

MagiXells1.RenameSheet(0, 'Overview');

GetSheetVisibility

Visibility: public
Declaration

Delphi
function GetSheetVisibility(AIndex: Integer): TSheetVisibility;
C++
TSheetVisibility __fastcall GetSheetVisibility(int AIndex);

Where used: Returns svVisible, svHidden, or svVeryHidden. Same data as Workbook.GetSheet(I).Visibility.

How to use:

var I: Integer;
begin
  for I := 0 to MagiXells1.SheetCount - 1 do
    if MagiXells1.GetSheetVisibility(I) <> svVisible then
      Memo1.Lines.Add(MagiXells1.Workbook.GetSheet(I).Name);
end;

SetSheetVisibility

Visibility: public
Declaration

Delphi
procedure SetSheetVisibility(AIndex: Integer; AVisibility: TSheetVisibility);
C++
void __fastcall SetSheetVisibility(int AIndex, TSheetVisibility AVisibility);

Where used: Show, hide, or very-hide a sheet by index.

How to use:

MagiXells1.SetSheetVisibility(1, svHidden);
MagiXells1.SetSheetVisibility(2, svVeryHidden);
MagiXells1.SetSheetVisibility(1, svVisible);

HideSheet

Visibility: public
Declaration

Delphi
procedure HideSheet(AIndex: Integer; AVeryHidden: Boolean = False);
C++
void __fastcall HideSheet(int AIndex, bool AVeryHidden = false);

Where used: Convenience wrapper around SetSheetVisibility. AVeryHidden=TruesvVeryHidden.

How to use:

MagiXells1.HideSheet(1);        { svHidden }
MagiXells1.HideSheet(2, True);  { svVeryHidden }
MagiXells1.TabBar.ShowHiddenSheets := True;  { list on tab bar }

UnhideSheet

Visibility: public
Declaration

Delphi
procedure UnhideSheet(AIndex: Integer);
C++
void __fastcall UnhideSheet(int AIndex);

Where used: Set sheet visibility back to svVisible.

How to use:

MagiXells1.UnhideSheet(1);

GetWorkbook

Visibility: public
Declaration

Delphi
function GetWorkbook: TWorkbook;
C++
TWorkbook* __fastcall GetWorkbook();

Where used: Same object as published Workbook. Useful when you prefer a function call style.

How to use:

var Wb: TWorkbook;
begin
  Wb := MagiXells1.GetWorkbook;  { = MagiXells1.Workbook }
end;

GetActiveSheet

Visibility: public
Declaration

Delphi
function GetActiveSheet: TWorksheet;
C++
TWorksheet* __fastcall GetActiveSheet();

Where used: Same object as published ActiveSheet.

How to use:

Caption := MagiXells1.GetActiveSheet.Name;

Undo / redo

Undo

Visibility: public
Declaration

Delphi
procedure Undo;
C++
void __fastcall Undo();

Where used: Undo the last command if CanUndo. Wire to Edit → Undo and OnHistoryChanged.

How to use:

if MagiXells1.CanUndo then
  MagiXells1.Undo;

Redo

Visibility: public
Declaration

Delphi
procedure Redo;
C++
void __fastcall Redo();

Where used: Redo if CanRedo.

How to use:

if MagiXells1.CanRedo then
  MagiXells1.Redo;

ShowPageSetup

Visibility: public
Declaration

Delphi
function ShowPageSetup: Boolean;
C++
bool __fastcall ShowPageSetup();

Where used: Show the page-setup dialog for the active sheet. Returns True if the user accepted.

How to use:

if MagiXells1.ShowPageSetup then
  { settings applied };

PrintPreview (job)

Visibility: public
Declaration

Delphi
function PrintPreview(AJob: TPrintJobSettings): Boolean; overload;
C++
bool __fastcall PrintPreview(TPrintJobSettings AJob) /* overload */;

Where used: Preview with an explicit print job (what to print, pages, …).

How to use:

var Job: TPrintJobSettings;
begin
  Job := TPrintJobSettings.Default;
  MagiXells1.PrintPreview(Job);
end;

PrintPreview

Visibility: public
Declaration

Delphi
function PrintPreview: Boolean; overload;
C++
bool __fastcall PrintPreview() /* overload */;

Where used: Preview using default job settings for the active context.

How to use:

MagiXells1.PrintPreview;

Visibility: public
Declaration

Delphi
function Print(AJob: TPrintJobSettings; AShowDialog: Boolean = True): Boolean; overload;
C++
bool __fastcall Print(TPrintJobSettings AJob, bool AShowDialog = true) /* overload */;

Where used: Print with an explicit job. AShowDialog=False skips the printer dialog when the host already chose settings.

How to use:

var Job: TPrintJobSettings;
begin
  Job := TPrintJobSettings.Default;
  MagiXells1.Print(Job, True);
end;

Visibility: public
Declaration

Delphi
function Print(AShowDialog: Boolean = True): Boolean; overload;
C++
bool __fastcall Print(bool AShowDialog = true) /* overload */;

Where used: Print with defaults; optionally show the system print dialog.

How to use:

MagiXells1.Print(True);

SetPrintAreaFromSelection

Visibility: public
Declaration

Delphi
procedure SetPrintAreaFromSelection;
C++
void __fastcall SetPrintAreaFromSelection();

Where used: Define the sheet print area from the current selection.

How to use:

MagiXells1.SelectRange(TCellRange.FromA1('A1:G40'));
MagiXells1.SetPrintAreaFromSelection;

ClearPrintArea

Visibility: public
Declaration

Delphi
procedure ClearPrintArea;
C++
void __fastcall ClearPrintArea();

Where used: Clear the active sheet’s print area.

How to use:

MagiXells1.ClearPrintArea;

SetPrintTitlesFromSelection

Visibility: public
Declaration

Delphi
procedure SetPrintTitlesFromSelection;
C++
void __fastcall SetPrintTitlesFromSelection();

Where used: Use the selection as repeating print titles (rows and/or columns, Excel-like).

How to use:

MagiXells1.SelectRange(1, 1, 1, 1);  { row 1 as title row example }
MagiXells1.SetPrintTitlesFromSelection;

External data providers

Host-supplied interfaces for STOCKHISTORY, RTD, GOOGLEFINANCE, translate, and IMPORTRANGE. Defaults and details: Formulas guide. Interfaces live in MagiXells.ExternalData. Properties also exist on TWorkbook.

StockHistoryProvider

Visibility: public
Declaration

Delphi
property StockHistoryProvider: IMagiXellsStockHistoryProvider;
C++
__property _di_IMagiXellsStockHistoryProvider StockHistoryProvider;

Where used: Optional host feed for STOCKHISTORY. If unset, MagiXells may use Yahoo Finance chart defaults.

How to use:

MagiXells1.StockHistoryProvider := TMyStockFeed.Create;

RtdProvider

Visibility: public
Declaration

Delphi
property RtdProvider: IMagiXellsRtdProvider;
C++
__property _di_IMagiXellsRtdProvider RtdProvider;

Where used: Optional host RTD server. If unset, Windows COM IRtdServer may be tried; else #N/A.

How to use:

MagiXells1.RtdProvider := MyRtdFeed;

GoogleFinanceProvider

Visibility: public
Declaration

Delphi
property GoogleFinanceProvider: IMagiXellsGoogleFinanceProvider;
C++
__property _di_IMagiXellsGoogleFinanceProvider GoogleFinanceProvider;

Where used: Optional host for GOOGLEFINANCE. Else Yahoo-backed defaults for common attributes.

How to use:

MagiXells1.GoogleFinanceProvider := MyFinance;

TranslateProvider

Visibility: public
Declaration

Delphi
property TranslateProvider: IMagiXellsTranslateProvider;
C++
__property _di_IMagiXellsTranslateProvider TranslateProvider;

Where used: Required for GOOGLETRANSLATE / TRANSLATE / DETECTLANGUAGE in production (#N/A without a provider).

How to use:

MagiXells1.TranslateProvider := MyTranslate;

ImportRangeProvider

Visibility: public
Declaration

Delphi
property ImportRangeProvider: IMagiXellsImportRangeProvider;
C++
__property _di_IMagiXellsImportRangeProvider ImportRangeProvider;

Where used: Required for IMPORTRANGE (#N/A otherwise).

How to use:

MagiXells1.ImportRangeProvider := MyImportRange;

NotifyRtdUpdate

Visibility: public
Declaration

Delphi
procedure NotifyRtdUpdate(const AProgId, AServer: string; const ATopics: TArray<string>);
C++
void __fastcall NotifyRtdUpdate(
  const System::UnicodeString AProgId,
  const System::UnicodeString AServer,
  const System::DynamicArray<string> &ATopics
);

Where used: Tell the evaluator that live RTD topics changed so dependent cells refresh.

How to use:

MagiXells1.NotifyRtdUpdate('My.Feed', '', ['BID', 'MSFT']);

Getter/setter methods (GetStockHistoryProvider / SetStockHistoryProvider, and the same pattern for RTD / Google Finance / Translate / ImportRange) are public equivalents of the properties above — prefer the properties in Delphi.


Public properties

GridView

Visibility: public
Declaration

Delphi
property GridView: TMagiXellsGridView; { FMX: TFmxMagiXellsGridView }
C++
__property TMagiXellsGridView* GridView;

Where used: Inner grid view for advanced invalidate / hit-test hosts. Prefer control-level APIs when possible.

How to use:

if MagiXells1.GridView <> nil then
  MagiXells1.GridView.Invalidate;

Controller

Visibility: public
Declaration

Delphi
property Controller: TGridController read GetController;
C++
__property TGridController* Controller;

Where used: Grid controller (selection, viewport, input). Nil-check before use during early construction.

How to use:

if MagiXells1.Controller <> nil then
  MagiXells1.EnsureSelectionVisible;

Selection

Visibility: public
Declaration

Delphi
property Selection: TGridSelection read GetSelection;
C++
__property TGridSelection* Selection;

Where used: Live selection model. Prefer SelectCell / SelectRange / ActiveCol for host UI.

How to use:

if MagiXells1.Selection <> nil then
  MagiXells1.CopySelection;

Evaluator

Visibility: public
Declaration

Delphi
property Evaluator: TFormulaEvaluator read FEvaluator;
C++
__property TFormulaEvaluator* Evaluator;

Where used: Shared formula engine. Evaluate computes without writing cells; use Recalculate / auto-calc to update the sheet. See Formulas — evaluate without changing the sheet.

How to use:

var
  V: TCellValue;
begin
  V := MagiXells1.Evaluator.Evaluate('=SUM(A1:A10)');
  ShowMessage(V.ToDisplayString);
  V := MagiXells1.Evaluator.Evaluate('=1+2', MagiXells1.ActiveSheetIndex);
end;

Key members on TFormulaEvaluator:

Member Role
Evaluate(const AFormula: string; ASheetIndex: Integer = -1): TCellValue Parse and compute; does not modify the sheet. Sheet index -1 = active sheet for refs.
EvaluateCell(ASheetIndex, ACol, ARow): TCellValue Evaluate a cell’s formula and refresh its cached value (1-based col/row).
RecalculateAll Full workbook recalc (same as MagiXells1.Recalculate).

NamedRanges

Visibility: public
Declaration

Delphi
property NamedRanges: TMagiXellsNamedRanges read FNamedRanges;
C++
__property TMagiXellsNamedRanges* NamedRanges;

Where used: Workbook-defined names. Full API: Host options — NamedRanges.

How to use:

MagiXells1.NamedRanges.AddOrSet('Data', 'Sheet1!$A$1:$A$10');

SheetCount

Visibility: public
Declaration

Delphi
property SheetCount: Integer read GetSheetCount;
C++
__property int SheetCount;

Where used: Number of worksheets (including hidden).

How to use:

ShowMessage(IntToStr(MagiXells1.SheetCount));

CanUndo

Visibility: public
Declaration

Delphi
property CanUndo: Boolean read GetCanUndo;
C++
__property bool CanUndo;

Where used: Enable/disable Undo actions; refresh on OnHistoryChanged.

How to use:

actUndo.Enabled := MagiXells1.CanUndo;

CanRedo

Visibility: public
Declaration

Delphi
property CanRedo: Boolean read GetCanRedo;
C++
__property bool CanRedo;

Where used: Enable/disable Redo actions.

How to use:

actRedo.Enabled := MagiXells1.CanRedo;

Options

Visibility: public
Declaration

Delphi
property Options: TMagiXellsOptions; { FMX: TFmxMagiXellsOptions }
C++
__property TMagiXellsOptions* Options;

Where used: Legacy set API (soShowFormulaBar, soShowSheetTabs, soShowHeaders, soReadOnly). Prefer Behavior / ViewOptions / flat published toggles in the Object Inspector.

How to use:

MagiXells1.Options := [soShowFormulaBar, soShowSheetTabs, soShowHeaders];

VisibleTopRow / VisibleBottomRow / VisibleLeftCol / VisibleRightCol

Visibility: public
Declaration

Delphi
property Visible*: Integer;  (read-only)
C++
/* property Visible*: Integer;  (read-only) */

Where used: Full on-screen bounding box (1-based), including frozen panes. Same info as GetVisibleRange.

How to use:

{ FrozenRows=1 and scrolled so row 20 is first scrollable row: }
{ VisibleTopRow = 1; ScrollableTopRow = 20 }
R := MagiXells1.GetVisibleRange;

ScrollableTopRow / ScrollableBottomRow / ScrollableLeftCol / ScrollableRightCol

Visibility: public
Declaration

Delphi
property ScrollableTopRow / ScrollableLeftCol: Integer;  (read/write); Bottom/Right read-only
C++
/* property ScrollableTopRow / ScrollableLeftCol: Integer;  (read/write); Bottom/Right read-only */

Where used: Unfrozen / scrollable pane. Writing ScrollableTopRow / ScrollableLeftCol scrolls. Values ≤ freeze count clamp to the first scrollable cell.

How to use:

MagiXells1.ScrollableTopRow := 20;
MagiXells1.ScrollableLeftCol := 5;

Published MagiXells properties

Version

Visibility: published (read-only)
Declaration

Delphi
property Version: string read GetVersion stored False;
C++
__property System::UnicodeString Version;

Where used: Library version in the Object Inspector and at runtime (MagiXellsVersion in types). Not streamed to the DFM.

How to use:

Caption := 'MagiXells ' + MagiXells1.Version;

ShowFormulaBar

Visibility: published
Declaration

Delphi
property ShowFormulaBar: Boolean … default True;
C++
__property Boolean … ShowFormulaBar;

Where used: Show or hide the formula bar chrome.

How to use:

MagiXells1.ShowFormulaBar := True;

ShowSheetTabs

Visibility: published
Declaration

Delphi
property ShowSheetTabs: Boolean … default True;
C++
__property Boolean … ShowSheetTabs;

Where used: Show or hide the bottom sheet tab strip (also mirrored on TabBar.Visible).

How to use:

MagiXells1.ShowSheetTabs := True;

Behavior

Visibility: published
Declaration

Delphi
property Behavior: TMagiXellsBehaviorOptions;
C++
__property TMagiXellsBehaviorOptions* Behavior;

Where used: Editing/clipboard/history policy. Full member list: Host options.

How to use:

MagiXells1.Behavior.AllowEdit := True;
MagiXells1.Behavior.EnterMoves := emDown;
MagiXells1.Behavior.TabKey := tkNextCell;  { or tkNextControl }
MagiXells1.Behavior.AutoCalculate := True;

TabKey while the sheet has focus:

Value Behavior
tkNextCell (default) Move active cell right / left (Excel-like)
tkNextControl Leave MagiXells and focus the next / previous form control

Focusing MagiXells activates the sheet, not the formula bar.

ViewOptions

Visibility: published
Declaration

Delphi
property ViewOptions: TMagiXellsViewOptions;
C++
__property TMagiXellsViewOptions* ViewOptions;

Where used: View flags (smooth drawing, R1C1, …). See host-options.

How to use:

MagiXells1.ViewOptions.SmoothDrawing := True;
MagiXells1.ViewOptions.R1C1 := False;

Appearance

Visibility: published
Declaration

Delphi
property Appearance: TMagiXellsUiTheme;
C++
__property TMagiXellsUiTheme* Appearance;

Where used: Sheet chrome theme (headers, selection, tabs). AI chat colors are separate (TMagiXellsAIChatTheme). See host-options.

How to use:

MagiXells1.Appearance.Preset := utpExcelLight;
{ or utpExcelDark / utpExcelDarkGray / utpMagiXellsBrand }

Protection

Visibility: published
Declaration

Delphi
property Protection: TMagiXellsProtectionOptions;
C++
__property TMagiXellsProtectionOptions* Protection;

Where used: Host protection toggles (structure, …). See host-options.

How to use:

MagiXells1.Protection.ProtectStructure := False;

TabBar

Visibility: published
Declaration

Delphi
property TabBar: TMagiXellsTabBarOptions;
C++
__property TMagiXellsTabBarOptions* TabBar;

Where used: Sheet tab bar options (new button, show hidden sheets, …).

How to use:

MagiXells1.TabBar.ShowNewButton := True;
MagiXells1.TabBar.ShowHiddenSheets := False;

ReadOnly

Visibility: published
Declaration

Delphi
property ReadOnly: Boolean … default False;
C++
__property Boolean … ReadOnly;

Where used: Host-level read-only (blocks edits regardless of sheet protection details).

How to use:

MagiXells1.ReadOnly := False;

Workbook

Visibility: published
Declaration

Delphi
property Workbook: TWorkbook read GetWorkbook;
C++
__property TWorkbook* Workbook;

Where used: Root workbook object. Use with SheetAPI (UseActiveSheet, UseSheet).

How to use:

MagiXells1.Workbook.UseActiveSheet.Cell['A1'].Text := 'Hi';

ActiveSheet

Visibility: published
Declaration

Delphi
property ActiveSheet: TWorksheet read GetActiveSheet;
C++
__property TWorksheet* ActiveSheet;

Where used: Currently active TWorksheet (nil only in pathological teardown).

How to use:

Caption := MagiXells1.ActiveSheet.Name;

ActiveSheetIndex

Visibility: published
Declaration

Delphi
property ActiveSheetIndex: Integer;
C++
__property int ActiveSheetIndex;

Where used: 0-based index of the active sheet.

How to use:

MagiXells1.ActiveSheetIndex := 0;

ActiveCol

Visibility: published
Declaration

Delphi
property ActiveCol: Integer;
C++
__property int ActiveCol;

Where used: 1-based active column (1 = A). Writing moves the active cell.

How to use:

MagiXells1.ActiveCol := 2;  { column B }

ActiveRow

Visibility: published
Declaration

Delphi
property ActiveRow: Integer;
C++
__property int ActiveRow;

Where used: 1-based active row. Writing moves the active cell.

How to use:

MagiXells1.ActiveRow := 5;

Zoom

Visibility: published
Declaration

Delphi
property Zoom: Integer … default 100;
C++
__property _di_Integer … Zoom;

Where used: Sheet view scale as a percent (100 = 100%). Typical range 10–400. See measurement units.

How to use:

MagiXells1.Zoom := 125;

ShowHeaders

Visibility: published
Declaration

Delphi
property ShowHeaders: Boolean … default True;
C++
__property Boolean … ShowHeaders;

Where used: Show row/column header gutters.

How to use:

MagiXells1.ShowHeaders := True;

ShowGridLines

Visibility: published
Declaration

Delphi
property ShowGridLines: Boolean … default True;
C++
__property Boolean … ShowGridLines;

Where used: Show cell gridlines.

How to use:

MagiXells1.ShowGridLines := True;

ShowFormulas

Visibility: published
Declaration

Delphi
property ShowFormulas: Boolean … default False;
C++
__property Boolean … ShowFormulas;

Where used: Display formulas instead of calculated values (Excel-like).

How to use:

MagiXells1.ShowFormulas := False;

ShowZeros

Visibility: published
Declaration

Delphi
property ShowZeros: Boolean … default True;
C++
__property Boolean … ShowZeros;

Where used: When False, hide zero values in the display (Excel-like).

How to use:

MagiXells1.ShowZeros := True;

DefaultColWidth

Visibility: published
Declaration

Delphi
property DefaultColWidth: Double;
C++
__property double DefaultColWidth;

Where used: Default column width in Excel character units (width of the Normal font’s 0 digit), not pixels. See measurement units.

How to use:

MagiXells1.DefaultColWidth := 10;

DefaultRowHeight

Visibility: published
Declaration

Delphi
property DefaultRowHeight: Double;
C++
__property double DefaultRowHeight;

Where used: Default row height in points (1 pt = 1/72 inch).

How to use:

MagiXells1.DefaultRowHeight := 15;

DefaultFont

Visibility: published
Declaration

Delphi
property DefaultFont: TFont;
C++
__property TFont* DefaultFont;

Where used: Workbook Normal style (StyleSheet font / xf 0). Empty cells inherit these. Size is points. VCL TFont.Color maps to Normal font color; FMX TFont has no color — use GetDefaultFont / SetDefaultFont for color. Legacy DFM keys still load.

How to use:

MagiXells1.DefaultFont.Name := 'Segoe UI';   { VCL }
{ FMX: MagiXells1.DefaultFont.Family := 'Segoe UI'; }
MagiXells1.DefaultFont.Size := 12;
MagiXells1.DefaultFont.Style := [];
{ VCL }
MagiXells1.DefaultFont.Color := clBlack;

Info := MagiXells1.GetDefaultFont;
Info.Name := 'Consolas';
Info.Size := 10;
MagiXells1.SetDefaultFont(Info);

Re-apply after NewWorkbook / load if you need a non-Calibri Normal font.

FormulaBarFont

Visibility: published
Declaration

Delphi
property FormulaBarFont: TFont;
C++
__property TFont* FormulaBarFont;

Where used: Typeface for formula-bar edits (name box + formula). Color comes from Appearance.FormulaBarText. VCL scales this font in ChangeScale.

How to use:

MagiXells1.FormulaBarFont.Name := 'Segoe UI';  { VCL; FMX uses .Family }
MagiXells1.FormulaBarFont.Size := 9;

FormulaBarHeight

Visibility: published
Declaration

Delphi
property FormulaBarHeight: Integer … default 0;
C++
__property _di_Integer … FormulaBarHeight;

Where used: Pixel height of the formula bar. 0 sizes to the font. A positive value is a minimum — the bar will not shrink below font needs; name/formula boxes grow to fill. VCL scales in ChangeScale.

How to use:

MagiXells1.FormulaBarHeight := 36;

SheetTabFont

Visibility: published
Declaration

Delphi
property SheetTabFont: TFont;
C++
__property TFont* SheetTabFont;

Where used: Type for bottom sheet tabs only. Color is Appearance.TabText.

How to use:

MagiXells1.SheetTabFont.Name := 'Segoe UI';
MagiXells1.SheetTabFont.Size := 9;

FrozenRows

Visibility: published
Declaration

Delphi
property FrozenRows: Integer … default 0;
C++
__property _di_Integer … FrozenRows;

Where used: Number of frozen rows at the top of the active sheet (Excel freeze panes).

How to use:

MagiXells1.FrozenRows := 1;

FrozenCols

Visibility: published
Declaration

Delphi
property FrozenCols: Integer … default 0;
C++
__property _di_Integer … FrozenCols;

Where used: Number of frozen columns at the left (or right when RTL).

How to use:

MagiXells1.FrozenCols := 1;

SheetRightToLeft

Visibility: published
Declaration

Delphi
property SheetRightToLeft: Boolean … default False;
C++
__property Boolean … SheetRightToLeft;

Where used: Sheet-level RTL layout (column A on the right). Distinct from form BiDiMode where applicable.

How to use:

MagiXells1.SheetRightToLeft := True;

Modified

Visibility: published
Declaration

Delphi
property Modified: Boolean read IsModified;
C++
__property bool Modified;

Where used: Published dirty flag for Object Inspector / data binding. Same as IsModified.

How to use:

actSave.Enabled := MagiXells1.Modified;

Inherited layout (VCL)

Visibility: published
Declaration

Delphi
{ standard `TCustomControl` / VCL layout properties }
C++
/* standard `TCustomControl` / VCL layout properties */

Where used: Place the control on a form like any VCL control.

How to use:

Published from the VCL ancestor as needed: Align, Anchors, Visible, Enabled, Color, ParentColor, ParentBackground, PopupMenu, Hint, ShowHint, Constraints, DoubleBuffered, TabStop.

MagiXells1.Align := alClient;
MagiXells1.TabStop := True;

Inherited layout (FMX)

Visibility: published
Declaration

Delphi
{ standard `TControl` layout properties }
C++
/* standard `TControl` layout properties */

Where used: Place the control on an FMX form/layout.

How to use:

Align, Position, Size, Visible, Enabled, HitTest, Opacity, PopupMenu, TabOrder, TabStop.

FmxMagiXells1.Align := TAlignLayout.Client;

Published MagiXells events

Wire these in the Object Inspector or assign at runtime. Event types for MagiXells-specific handlers live in MagiXells.HostOptions, MagiXells.Types, MagiXells.DataValidation, and MagiXells.Grid.Renderer as noted.

OnCellChanged

Visibility: published
Declaration

Delphi
property OnCellChanged: TCellChangedEvent;
C++
__property TCellChangedEvent OnCellChanged;

Where used: After an interactive cell change. Assign a new NewValue to rewrite the cell (does not re-fire). Programmatic SheetAPI edits do not fire this. Type: MagiXells.Types.

How to use:

procedure TForm1.MagiXells1CellChanged(Sender: TObject; const SheetIndex: Integer;
  const Address: TCellAddress; const OldValue: TCellValue; var NewValue: TCellValue);
begin
  if NewValue.Kind = cvkText then
    NewValue := TCellValue.FromText(UpperCase(NewValue.Text));
end;

{ in FormCreate or OI: }
MagiXells1.OnCellChanged := MagiXells1CellChanged;

TCellChangedEvent = procedure(Sender: TObject; const SheetIndex: Integer; const Address: TCellAddress; const OldValue: TCellValue; var NewValue: TCellValue) of object;

OnSelectionChanged

Visibility: published
Declaration

Delphi
property OnSelectionChanged: TNotifyEvent;
C++
__property TNotifyEvent OnSelectionChanged;

Where used: Active cell or selection rectangle changed (click, keyboard, SelectCell / SelectRange).

How to use:

procedure TForm1.MagiXells1SelectionChanged(Sender: TObject);
begin
  StatusBar1.SimpleText := Format('%s',
    [TCellAddress.Create(MagiXells1.ActiveCol, MagiXells1.ActiveRow).ToA1]);
end;

MagiXells1.OnSelectionChanged := MagiXells1SelectionChanged;

OnModified

Visibility: published
Declaration

Delphi
property OnModified: TNotifyEvent;
C++
__property TNotifyEvent OnModified;

Where used: Workbook dirty flag became true (may be deferred until EndUpdate). Enable Save UI here.

How to use:

procedure TForm1.MagiXells1Modified(Sender: TObject);
begin
  actSave.Enabled := MagiXells1.Modified;
end;

MagiXells1.OnModified := MagiXells1Modified;

OnSheetChanged

Visibility: published
Declaration

Delphi
property OnSheetChanged: TNotifyEvent;
C++
__property TNotifyEvent OnSheetChanged;

Where used: Active sheet changed (tab click, ActiveSheetIndex, add/remove).

How to use:

procedure TForm1.MagiXells1SheetChanged(Sender: TObject);
begin
  Caption := MagiXells1.ActiveSheet.Name;
end;

MagiXells1.OnSheetChanged := MagiXells1SheetChanged;

OnLayoutChanged

Visibility: published
Declaration

Delphi
property OnLayoutChanged: TNotifyEvent;
C++
__property TNotifyEvent OnLayoutChanged;

Where used: Row/column sizes or structure layout changed (resize, insert/delete, freeze).

How to use:

procedure TForm1.MagiXells1LayoutChanged(Sender: TObject);
begin
  { sync overlays / rulers }
end;

MagiXells1.OnLayoutChanged := MagiXells1LayoutChanged;

OnViewportChanged

Visibility: published
Declaration

Delphi
property OnViewportChanged: TNotifyEvent;
C++
__property TNotifyEvent OnViewportChanged;

Where used: Scroll or zoom changed the visible window.

How to use:

procedure TForm1.MagiXells1ViewportChanged(Sender: TObject);
begin
  { update minimap / status }
end;

MagiXells1.OnViewportChanged := MagiXells1ViewportChanged;

OnEditTextChanged

Visibility: published
Declaration

Delphi
property OnEditTextChanged: TNotifyEvent;
C++
__property TNotifyEvent OnEditTextChanged;

Where used: Live text while editing (inplace or formula bar) — for formula assist / status.

How to use:

procedure TForm1.MagiXells1EditTextChanged(Sender: TObject);
begin
  { live text while editing }
end;

MagiXells1.OnEditTextChanged := MagiXells1EditTextChanged;

OnFormulaEdited

Visibility: published
Declaration

Delphi
property OnFormulaEdited: TNotifyEvent;
C++
__property TNotifyEvent OnFormulaEdited;

Where used: Formula bar committed a formula edit.

How to use:

procedure TForm1.MagiXells1FormulaEdited(Sender: TObject);
begin
  { formula bar commit }
end;

MagiXells1.OnFormulaEdited := MagiXells1FormulaEdited;

OnEditStart

Visibility: published
Declaration

Delphi
property OnEditStart: TNotifyEvent;
C++
__property TNotifyEvent OnEditStart;

Where used: Entered edit mode (after OnBeforeEdit allowed it).

How to use:

procedure TForm1.MagiXells1EditStart(Sender: TObject);
begin
  { entered edit mode }
end;

MagiXells1.OnEditStart := MagiXells1EditStart;

OnEditCommit

Visibility: published
Declaration

Delphi
property OnEditCommit: TNotifyEvent;
C++
__property TNotifyEvent OnEditCommit;

Where used: Edit committed successfully.

How to use:

procedure TForm1.MagiXells1EditCommit(Sender: TObject);
begin
  { edit committed }
end;

MagiXells1.OnEditCommit := MagiXells1EditCommit;

OnEditCancel

Visibility: published
Declaration

Delphi
property OnEditCancel: TNotifyEvent;
C++
__property TNotifyEvent OnEditCancel;

Where used: Edit cancelled (Escape / CancelEdit).

How to use:

procedure TForm1.MagiXells1EditCancel(Sender: TObject);
begin
  { edit cancelled }
end;

MagiXells1.OnEditCancel := MagiXells1EditCancel;

OnBeforeEdit

Visibility: published
Declaration

Delphi
property OnBeforeEdit: TMagiXellsBeforeEditEvent;
C++
__property TMagiXellsBeforeEditEvent OnBeforeEdit;

Where used: Cancel starting an edit (F2, typing, double-click, BeginEdit). FAllowed defaults to True. Col/Row are 1-based.

How to use:

procedure TForm1.MagiXells1BeforeEdit(Sender: TObject; ACol, ARow: Integer;
  var FAllowed: Boolean);
begin
  FAllowed := ARow > 1;  { lock header row 1 }
end;

MagiXells1.OnBeforeEdit := MagiXells1BeforeEdit;

TMagiXellsBeforeEditEvent = procedure(Sender: TObject; ACol, ARow: Integer; var FAllowed: Boolean) of object;

OnActiveCellChanging

Visibility: published
Declaration

Delphi
property OnActiveCellChanging: TMagiXellsActiveCellChangingEvent;
C++
__property TMagiXellsActiveCellChangingEvent OnActiveCellChanging;

Where used: About to move the active cell. Set Allow := False to keep the current cell. Col/Row are 1-based.

How to use:

procedure TForm1.MagiXells1ActiveCellChanging(Sender: TObject;
  ACol, ARow: Integer; var Allow: Boolean);
begin
  Allow := ARow >= 1;  { always true example; use business rules }
  if ARow = 1 then
    Allow := False;  { refuse landing on header row }
end;

MagiXells1.OnActiveCellChanging := MagiXells1ActiveCellChanging;

TMagiXellsActiveCellChangingEvent = procedure(Sender: TObject; ACol, ARow: Integer; var Allow: Boolean) of object;

OnBeforeColResize / OnColResized

Visibility: published
Declaration

Delphi
property OnBeforeColResize: TMagiXellsBeforeColResizeEvent; property OnColResized: TMagiXellsColResizedEvent;
C++
__property TMagiXellsBeforeColResizeEvent OnBeforeColResize;
__property TMagiXellsColResizedEvent OnColResized;

Where used: OnBefore* when a drag resize starts (or before double-click autofit) — set Allow := False to cancel. OnColResized fires once when width actually changes (mouse-up / autofit), not every live pixel. Col is 1-based. Widths are character units.

How to use:

procedure TForm1.MagiXells1BeforeColResize(Sender: TObject; SheetIndex, Col: Integer;
  OldWidthChars: Double; var Allow: Boolean);
begin
  Allow := Col <> 1;  { lock column A }
end;

procedure TForm1.MagiXells1ColResized(Sender: TObject; SheetIndex, Col: Integer;
  OldWidthChars, NewWidthChars: Double);
begin
  StatusBar1.SimpleText := Format('Col %s: %.2f → %.2f',
    [ColToLetters(Col), OldWidthChars, NewWidthChars]);
end;

MagiXells1.OnBeforeColResize := MagiXells1BeforeColResize;
MagiXells1.OnColResized := MagiXells1ColResized;

OnBeforeRowResize / OnRowResized

Visibility: published
Declaration

Delphi
property OnBeforeRowResize: TMagiXellsBeforeRowResizeEvent; property OnRowResized: TMagiXellsRowResizedEvent;
C++
__property TMagiXellsBeforeRowResizeEvent OnBeforeRowResize;
__property TMagiXellsRowResizedEvent OnRowResized;

Where used: Same pattern as column resize. Row is 1-based. Heights are points.

How to use:

procedure TForm1.MagiXells1BeforeRowResize(Sender: TObject; SheetIndex, Row: Integer;
  OldHeightPt: Double; var Allow: Boolean);
begin
  Allow := Row <> 1;
end;

procedure TForm1.MagiXells1RowResized(Sender: TObject; SheetIndex, Row: Integer;
  OldHeightPt, NewHeightPt: Double);
begin
  StatusBar1.SimpleText := Format('Row %d: %.1f → %.1f pt',
    [Row, OldHeightPt, NewHeightPt]);
end;

MagiXells1.OnBeforeRowResize := MagiXells1BeforeRowResize;
MagiXells1.OnRowResized := MagiXells1RowResized;

OnHistoryChanged

Visibility: published
Declaration

Delphi
property OnHistoryChanged: TNotifyEvent;
C++
__property TNotifyEvent OnHistoryChanged;

Where used: Undo stack changed — refresh Undo/Redo enabled state.

How to use:

procedure TForm1.MagiXells1HistoryChanged(Sender: TObject);
begin
  actUndo.Enabled := MagiXells1.CanUndo;
  actRedo.Enabled := MagiXells1.CanRedo;
end;

MagiXells1.OnHistoryChanged := MagiXells1HistoryChanged;

OnHyperlinkClick

Visibility: published
Declaration

Delphi
property OnHyperlinkClick: TMagiXellsHyperlinkClickEvent;
C++
__property TMagiXellsHyperlinkClickEvent OnHyperlinkClick;

Where used: User activated a hyperlink. Set Handled := True to skip MagiXells’ default follow (shell / internal jump).

How to use:

procedure TForm1.MagiXells1HyperlinkClick(Sender: TObject;
  const ATarget: string; var Handled: Boolean);
begin
  Handled := True;
  ShowMessage('Link: ' + ATarget);
end;

MagiXells1.OnHyperlinkClick := MagiXells1HyperlinkClick;

TMagiXellsHyperlinkClickEvent = procedure(Sender: TObject; const ATarget: string; var Handled: Boolean) of object;

OnCellClick / OnCellDblClick

Visibility: published
Declaration

Delphi
property OnCellClick: TMagiXellsCellClickEvent; property OnCellDblClick: TMagiXellsCellClickEvent;
C++
__property TMagiXellsCellClickEvent OnCellClick;
__property TMagiXellsCellClickEvent OnCellDblClick;

Where used: Pointer hit a cell (haCell). Single clicks → OnCellClick; the second down of a double-click (ssDouble) → OnCellDblClick (inplace do not fire these; drawings use OnDrawingClick). Col/Row are 1-based.

How to use:

procedure TForm1.MagiXells1CellClick(Sender: TObject; SheetIndex, Col, Row: Integer;
  Button: TMouseButton; Shift: TShiftState);
begin
  Caption := Format('Click %s sheet %d',
    [TCellAddress.Create(Col, Row).ToA1, SheetIndex]);
end;

procedure TForm1.MagiXells1CellDblClick(Sender: TObject; SheetIndex, Col, Row: Integer;
  Button: TMouseButton; Shift: TShiftState);
begin
  Caption := Format('Dbl %s', [TCellAddress.Create(Col, Row).ToA1]);
end;

MagiXells1.OnCellClick := MagiXells1CellClick;
MagiXells1.OnCellDblClick := MagiXells1CellDblClick;

TMagiXellsCellClickEvent = procedure(Sender: TObject; SheetIndex, Col, Row: Integer; Button: TMouseButton; Shift: TShiftState) of object;

OnDrawingClick

Visibility: published
Declaration

Delphi
property OnDrawingClick: TMagiXellsDrawingClickEvent;
C++
__property TMagiXellsDrawingClickEvent OnDrawingClick;

Where used: Pointer hit a drawing/chart/picture/shape, before selection or drag. Set Allow := False to refuse interaction.

How to use:

procedure TForm1.MagiXells1DrawingClick(Sender: TObject; SheetIndex, DrawingIndex: Integer;
  Drawing: TSheetDrawing; Button: TMouseButton; Shift: TShiftState; var Allow: Boolean);
begin
  if (Drawing <> nil) and (Drawing.Kind = sdkChart) then
    Allow := False;  { lock charts }
end;

MagiXells1.OnDrawingClick := MagiXells1DrawingClick;

TMagiXellsDrawingClickEvent = procedure(Sender: TObject; SheetIndex, DrawingIndex: Integer; Drawing: TSheetDrawing; Button: TMouseButton; Shift: TShiftState; var Allow: Boolean) of object;

OnDataValidation

Visibility: published
Declaration

Delphi
property OnDataValidation: TMagiXellsDataValidationEvent;
C++
__property TMagiXellsDataValidationEvent OnDataValidation;

Where used: Fired when an edit fails data validation. Set Handled := True to skip the built-in alert and use Accept to allow/reject. ACol/ARow are 1-based.

How to use:

procedure TForm1.MagiXells1DataValidation(Sender: TObject; ACol, ARow: Integer;
  const AValue: string; const ARule: TDataValidationRule;
  const AErrorTitle, AErrorMessage: string; AErrorStyle: TDataValidationErrorStyle;
  var Accept, Handled: Boolean);
begin
  Handled := False;  { MagiXells default Stop/Warning UI }
  Accept := True;
end;

MagiXells1.OnDataValidation := MagiXells1DataValidation;

OnProgress

Visibility: published
Declaration

Delphi
property OnProgress: TMagiXellsProgressEvent;
C++
__property TMagiXellsProgressEvent OnProgress;

Where used: Long I/O or heavy work progress (load/save). Update a status bar or progress gauge.

How to use:

procedure TForm1.MagiXells1Progress(Sender: TObject; APercent: Integer;
  const AStatus: string);
begin
  StatusBar1.SimpleText := Format('%d%% %s', [APercent, AStatus]);
end;

MagiXells1.OnProgress := MagiXells1Progress;

TMagiXellsProgressEvent = procedure(Sender: TObject; APercent: Integer; const AStatus: string) of object;

OnSheetTabClick

Visibility: published
Declaration

Delphi
property OnSheetTabClick: TMagiXellsSheetTabClickEvent;
C++
__property TMagiXellsSheetTabClickEvent OnSheetTabClick;

Where used: User clicked a sheet tab (ASheetIndex is 0-based). Fires in addition to sheet activation.

How to use:

procedure TForm1.MagiXells1SheetTabClick(Sender: TObject; ASheetIndex: Integer);
begin
  Log('Tab ' + IntToStr(ASheetIndex));
end;

MagiXells1.OnSheetTabClick := MagiXells1SheetTabClick;

OnNewSheet

Visibility: published
Declaration

Delphi
property OnNewSheet: TNotifyEvent;
C++
__property TNotifyEvent OnNewSheet;

Where used: User clicked the new-sheet button on the tab bar (before/around add — use to customize naming or veto via structure protection).

How to use:

procedure TForm1.MagiXells1NewSheet(Sender: TObject);
begin
  { user clicked + on the tab bar }
end;

MagiXells1.OnNewSheet := MagiXells1NewSheet;

OnCustomDrawCell

Visibility: published
Declaration

Delphi
property OnCustomDrawCell: TGridCustomDrawCellEvent;
C++
__property TGridCustomDrawCellEvent OnCustomDrawCell;

Where used: Optional overlay after the cell is painted. ACol/ARow are 1-based. ARect is in grid canvas coordinates (IGridCanvas).

How to use:

procedure TForm1.MagiXells1CustomDrawCell(Sender: TObject; ACanvas: IGridCanvas;
  ACol, ARow: Integer; const ARect: TGridRect);
begin
  { optional overlay drawing }
end;

MagiXells1.OnCustomDrawCell := MagiXells1CustomDrawCell;

TGridCustomDrawCellEvent = procedure(Sender: TObject; ACanvas: IGridCanvas; ACol, ARow: Integer; const ARect: TGridRect) of object;

OnGetHeaderText

Visibility: published
Declaration

Delphi
property OnGetHeaderText: TGridGetHeaderTextEvent;
C++
__property TGridGetHeaderTextEvent OnGetHeaderText;

Where used: Customize row/column header caption. AIndex matches sheet coordinates (1-based: column 1 = A, row 1 = first row). Leave AText unchanged to keep the default letter/number.

How to use:

procedure TForm1.MagiXells1GetHeaderText(Sender: TObject; AIsColumn: Boolean;
  AIndex: Integer; var AText: string);
begin
  if AIsColumn and (AIndex = 1) then
    AText := 'Item';
  if (not AIsColumn) and (AIndex = 1) then
    AText := '#';
end;

MagiXells1.OnGetHeaderText := MagiXells1GetHeaderText;

TGridGetHeaderTextEvent = procedure(Sender: TObject; AIsColumn: Boolean; AIndex: Integer; var AText: string) of object;

Inherited events

Visibility: published
Declaration

Delphi
{ standard control events }
C++
/* standard control events */

Where used: Form-level keyboard/mouse handling when MagiXells (or its focused child) participates in the control’s event surface.

How to use:

Standard control events are published for Object Inspector wiring. They are inherited, not MagiXells-specific:

procedure TForm1.MagiXells1Click(Sender: TObject);
begin
  { standard click }
end;

MagiXells1.OnClick := MagiXells1Click;

See also

MagiXells.Types

Shared core types every MagiXells host depends on: sheet limits, A1 addresses/ranges, typed cell values, file formats, and column-letter helpers.

Unit: MagiXells.Types
C++Builder: #include <MagiXells.Types.hpp> — see C++Builder.

Trial/Runtime installs ship compiled packages only (no library .pas). Use this page as the contract for these types.

All members below are public.

uses
  MagiXells.Types,
  MagiXells.Spreadsheet,   { or MagiXells.Spreadsheet.Fmx }
  MagiXells.SheetAPI;

var
  Addr: TCellAddress;
  R: TCellRange;
  V: TCellValue;
begin
  Addr := TCellAddress.FromA1('B2');
  R := TCellRange.FromA1('A1:C10');
  V := TCellValue.FromNumber(42);
  MagiXells1.Workbook.UseActiveSheet.Cell[Addr.ToA1].AsNumber := V.Number;
end;

Convention: MagiXells core addresses are 1-based (column 1 = A, row 1 = first row), matching Excel. Prefer A1 strings with SheetAPI when you can; use TCellAddress / TCellRange when you need numeric loops, hit-test coords, or evaluator/event payloads.


Constants

MagiXellsVersion

Visibility: public
Value: '0.93'

Where used: Single source for the library version string. TMagiXells.Version / TFmxMagiXells.Version return this value.

How to use:

if MagiXells1.Version <> MagiXellsVersion then
  raise Exception.Create('Unexpected MagiXells build');

MAX_EXCEL_ROWS

Visibility: public
Value: 1048576

Where used: Clamp row indices before writing cells, sizing loops, validating user input, or comparing against UsedMaxRow.

How to use: Treat any row outside 1..MAX_EXCEL_ROWS as invalid.

function ClampRow(ARow: Integer): Integer;
begin
  Result := Max(1, Min(ARow, MAX_EXCEL_ROWS));
end;

{ Walk every used row safely }
for Row := 1 to Min(Sheet.UsedMaxRow, MAX_EXCEL_ROWS) do
  …;

MAX_EXCEL_COLS

Visibility: public
Value: 16384 (column XFD)

Where used: Same as rows, for columns; also when converting letters with LettersToCol (rejects values above this).

if LettersToCol(UserColLetters) = 0 then
  raise Exception.Create('Not a valid column (A..XFD)');
Col := Min(LettersToCol(UserColLetters), MAX_EXCEL_COLS);

DEFAULT_COL_WIDTH_CHARS

Visibility: public
Value: 8.43

Where used: Understanding MagiXells / Excel default column width in character units (not CSS ch, not pixels). Useful when you reset widths or document sizing in your app.

{ Reset columns A..C to the workbook default character width (0-based indexes) }
MagiXells1.Workbook.UseActiveSheet.SetColWidthChars(0, 2, DEFAULT_COL_WIDTH_CHARS);

See measurement units.

DEFAULT_ROW_HEIGHT_PT

Visibility: public
Value: 15.0

Where used: Default row height in points (1/72 inch). Compare with print/page setup and row sizing docs.

{ Document or restore default }
Caption := Format('Default row height = %.1f pt', [DEFAULT_ROW_HEIGHT_PT]);

DEFAULT_COL_WIDTH_PX / DEFAULT_ROW_HEIGHT_PX

Visibility: public
Values: 64 / 20

Where used: Approximate default sizes in pixels at 96 DPI / 100% zoom. Handy for layout math next to the grid (panels, overlays). Zoom and DPI scale these; see measurement units.

ApproxTableW := DEFAULT_COL_WIDTH_PX * 5;  // ~5 default columns
ApproxTableH := DEFAULT_ROW_HEIGHT_PX * 10;
MyOverlay.Width := ApproxTableW;

Enumerations

TMagiXellsFileFormat

Visibility: public
Declaration

Delphi
TMagiXellsFileFormat = (ffAuto, ffMgx, ffXlsx, ffOds, ffCsv);
C++
enum class TMagiXellsFileFormat { ffAuto, ffMgx, ffXlsx, ffOds, ffCsv };
Value Meaning
ffAuto Infer from file extension (typical for LoadFromFile / SaveToFile)
ffMgx Native MagiXells workbook
ffXlsx Excel Open XML (also used for .xlsm detection)
ffOds OpenDocument Spreadsheet
ffCsv Comma-separated values

Where used: Required for stream I/O (LoadFromStream / SaveToStream) because streams have no extension. Optional when you want to force a format. Also returned by FileFormatFromExtension.

How to use:

uses MagiXells.Types, System.Classes;

procedure LoadXlsxFromMemory(AGrid: TMagiXells; ABytes: TBytes);
var
  MS: TMemoryStream;
begin
  MS := TMemoryStream.Create;
  try
    MS.WriteBuffer(ABytes[0], Length(ABytes));
    MS.Position := 0;
    { Streams must pass an explicit format — ffAuto is not enough }
    AGrid.LoadFromStream(MS, ffXlsx);
  finally
    MS.Free;
  end;
end;

{ Files: extension usually enough }
MagiXells1.LoadFromFile('C:\Data\report.xlsx');
MagiXells1.SaveToFile('C:\Data\report.mgx');

See Import / export.

TSheetVisibility

Visibility: public
Declaration

Delphi
TSheetVisibility = (svVisible, svHidden, svVeryHidden);
C++
enum class TSheetVisibility { svVisible, svHidden, svVeryHidden };
Value UI / Excel meaning
svVisible Shown on the sheet tab bar
svHidden Hidden; user can unhide
svVeryHidden Hidden; typically only code can show again

Where used: GetSheetVisibility / SetSheetVisibility on the control, or Worksheet.Visibility.

How to use:

var
  I: Integer;
begin
  { Hide every sheet except the first }
  for I := 0 to MagiXells1.SheetCount - 1 do
    if I = 0 then
      MagiXells1.SetSheetVisibility(I, svVisible)
    else
      MagiXells1.SetSheetVisibility(I, svHidden);

  if MagiXells1.GetSheetVisibility(1) = svVeryHidden then
    ShowMessage('Sheet 2 is very hidden');
end;

TCellValueKind

Visibility: public
Declaration

Delphi
TCellValueKind = (cvkEmpty, cvkText, cvkNumber, cvkBoolean, cvkError, cvkFormula);
C++
enum class TCellValueKind { cvkEmpty, cvkText, cvkNumber, cvkBoolean, cvkError, cvkFormula };

Where used: Always inspect TCellValue.Kind before reading Text / Number / BooleanValue / ErrorCode / Formula. Returned by Evaluator.Evaluate, cell change events, and core cell storage.

How to use:

procedure ShowValue(const V: TCellValue);
begin
  case V.Kind of
    cvkEmpty:   Caption := '(empty)';
    cvkText:    Caption := V.Text;
    cvkNumber:  Caption := FloatToStr(V.Number);
    cvkBoolean: Caption := BoolToStr(V.BooleanValue, True);
    cvkError:   Caption := ErrorCodeToString(V.ErrorCode);
    cvkFormula: Caption := V.Formula;  { e.g. '=A1+1' }
  end;
end;

{ After a what-if evaluate — does not write the sheet }
ShowValue(MagiXells1.Evaluator.Evaluate('=SUM(A1:A10)'));

TCellErrorCode

Visibility: public
Declaration

Delphi
TCellErrorCode = (ceNone, ceDiv0, ceNA, ceName, ceNull, ceNum, ceRef, ceValue, ceCirc, ceSpill);
C++
enum class TCellErrorCode { ceNone, ceDiv0, ceNA, ceName, ceNull, ceNum, ceRef, ceValue, ceCirc, ceSpill };
Code Display (ErrorCodeToString)
ceNone (not an error; use only as empty ErrorCode)
ceDiv0 #DIV/0!
ceNA #N/A
ceName #NAME?
ceNull #NULL!
ceNum #NUM!
ceRef #REF!
ceValue #VALUE!
ceCirc #CIRC!
ceSpill #SPILL!

Where used: When TCellValue.Kind = cvkError, or when you intentionally store an error with TCellValue.FromError.

How to use:

var
  V: TCellValue;
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  V := MagiXells1.Evaluator.Evaluate('=1/0');
  if V.Kind = cvkError then
  begin
    if V.ErrorCode = ceDiv0 then
      S.Cell['A1'].Text := 'Division by zero'
    else
      S.Cell['A1'].Text := ErrorCodeToString(V.ErrorCode);
  end;
end;

TCellAddress

1-based column/row coordinate for a single cell.

Where used: - Event args (OnCellChanged, OnCellClick, …) carry or build addresses - Building A1 strings for SheetAPI (Addr.ToA1) - Parsing user/input A1 with FromA1 - Loops that already have numeric Col/Row from hit-testing or selection

Fields

Visibility: public

Field Type Notes
Col Integer 1 = A … MAX_EXCEL_COLS = XFD
Row Integer 1MAX_EXCEL_ROWS
var Addr: TCellAddress;
begin
  Addr.Col := 2;
  Addr.Row := 5;
  Assert(Addr.ToA1 = 'B5');
end;

Create

Visibility: public
Declaration

Delphi
class function Create(ACol, ARow: Integer): TCellAddress; static;
C++
static TCellAddress __fastcall Create(int ACol, int ARow);

Where used: When you already have numeric col/row (click handlers, loops).

How to use:

procedure TForm1.MagiXells1CellClick(Sender: TObject; SheetIndex, Col, Row: Integer);
var
  Addr: TCellAddress;
begin
  { Col/Row from the control are 1-based }
  Addr := TCellAddress.Create(Col, Row);
  StatusBar1.SimpleText := 'Clicked ' + Addr.ToA1;
end;

IsValid

Visibility: public
Declaration

Delphi
function IsValid: Boolean;
C++
bool __fastcall IsValid();

Where used: After FromA1 / FromKey, or before using an address from untrusted input.

How to use:

function TryGotoCell(const ARef: string): Boolean;
var
  Addr: TCellAddress;
begin
  Addr := TCellAddress.FromA1(ARef);
  Result := Addr.IsValid;
  if Result then
    MagiXells1.SelectRange(
      TCellRange.Create(Addr.Col, Addr.Row, Addr.Col, Addr.Row));
end;

ToKey

Visibility: public
Declaration

Delphi
function ToKey: string;
C++
System::UnicodeString __fastcall ToKey();

Where used: Same as A1 for a single cell (internal sparse maps also use this shape). Prefer ToA1 in application code for clarity.

Key := TCellAddress.Create(27, 10).ToKey; // 'AA10'

ToA1

Visibility: public
Declaration

Delphi
function ToA1: string;
C++
System::UnicodeString __fastcall ToA1();

Where used: Bridge from numeric address → SheetAPI / UI labels / logs.

How to use:

var
  Addr: TCellAddress;
  S: TAuthoringSheet;
begin
  Addr := TCellAddress.Create(3, 1); // C1
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell[Addr.ToA1].Text := 'Header';
  Log(Addr.ToA1);
end;

FromA1

Visibility: public
Declaration

Delphi
class function FromA1(const ARef: string): TCellAddress; static;
C++
static TCellAddress __fastcall FromA1(const System::UnicodeString ARef);

Where used: Parse a plain A1 token from UI, files, or clipboard.
Limits: No $ absolutes, no sheet name (Sheet1!A1), no ranges (A1:B2 — use TCellRange.FromA1). Invalid input → Col = 0, Row = 0 (not IsValid).

How to use:

procedure WriteUserCell(const ARef, AText: string);
var
  Addr: TCellAddress;
begin
  Addr := TCellAddress.FromA1(Trim(ARef));
  if not Addr.IsValid then
    raise Exception.CreateFmt('Invalid cell reference: %s', [ARef]);
  MagiXells1.Workbook.UseActiveSheet.Cell[Addr.ToA1].Text := AText;
end;

WriteUserCell('b2', 'Hello'); // case-insensitive letters

FromKey

Visibility: public
Declaration

Delphi
class function FromKey(const AKey: string): TCellAddress; static;
C++
static TCellAddress __fastcall FromKey(const System::UnicodeString AKey);

Where used: Same as FromA1 (implementation delegates to it). Use when your code already talks about “keys”.

Addr := TCellAddress.FromKey('C3');

TCellRange

Inclusive rectangular block of cells (1-based). May be constructed with corners reversed; prefer Normalize or FromA1 (already normalized).

Where used: - MagiXells1.SelectRange(const ARange: TCellRange) - Hit-testing / “is this cell in the print area?” - Computing width/height of a block - Converting selection bounds to A1 for formulas or SheetAPI

Fields

Visibility: public

Field Type
StartCol, StartRow Integer
EndCol, EndRow Integer
var R: TCellRange;
begin
  R.StartCol := 1; R.StartRow := 1;
  R.EndCol := 3;   R.EndRow := 10;
end;

Create

Visibility: public
Declaration

Delphi
class function Create(const AStartCol, AStartRow, AEndCol, AEndRow: Integer): TCellRange; static;
C++
static TCellRange __fastcall Create(
  const int AStartCol,
  const int AStartRow,
  const int AEndCol,
  const int AEndRow
);

Where used: Numeric selection from loops or UI grids.

How to use:

var
  R: TCellRange;
begin
  { A1:C10 — all indices 1-based }
  R := TCellRange.Create(1, 1, 3, 10);
  MagiXells1.SelectRange(R);
end;

FromA1

Visibility: public
Declaration

Delphi
class function FromA1(const ARef: string): TCellRange; static;
C++
static TCellRange __fastcall FromA1(const System::UnicodeString ARef);

Where used: Parse 'A1' or 'A1:C10' from the user. Always returns a normalized range.

How to use:

procedure SelectUserRange(const ARef: string);
var
  R: TCellRange;
begin
  R := TCellRange.FromA1(ARef);
  if (R.StartCol < 1) or (R.StartRow < 1) then
    raise Exception.Create('Invalid range');
  MagiXells1.SelectRange(R);
  Caption := Format('%s (%d×%d)', [R.ToA1, R.Width, R.Height]);
end;

SelectUserRange('C10:A1'); // becomes A1:C10

Normalize

Visibility: public
Declaration

Delphi
function Normalize: TCellRange;
C++
TCellRange __fastcall Normalize();

Where used: After Create if the user dragged bottom→top or right→left.

How to use:

var R: TCellRange;
begin
  R := TCellRange.Create(5, 8, 2, 3); // unordered
  R := R.Normalize;                   // StartCol=2, StartRow=3, EndCol=5, EndRow=8
  Assert(R.ToA1 = 'B3:E8');
end;

Contains

Visibility: public
Declaration

Delphi
function Contains(const ACol, ARow: Integer): Boolean;
C++
bool __fastcall Contains(const int ACol, const int ARow);

Where used: Hit-test a cell against a selection, print area, or protected block.

How to use:

var
  PrintArea: TCellRange;
begin
  PrintArea := TCellRange.FromA1('A1:H40');
  if PrintArea.Contains(Col, Row) then
    StatusBar1.SimpleText := 'Inside print area';
end;

ContainsAddress

Visibility: public
Declaration

Delphi
function ContainsAddress(const AAddress: TCellAddress): Boolean;
C++
bool __fastcall ContainsAddress(const TCellAddress AAddress);

Where used: Same as Contains, when you already hold a TCellAddress.

if R.ContainsAddress(TCellAddress.FromA1('B2')) then
  …;

Intersects

Visibility: public
Declaration

Delphi
function Intersects(const AOther: TCellRange): Boolean;
C++
bool __fastcall Intersects(const TCellRange AOther);

Where used: Detect overlapping merges, selections, or chart data regions.

How to use:

var
  Sel, ChartData: TCellRange;
begin
  Sel := TCellRange.FromA1('A1:C5');
  ChartData := TCellRange.FromA1('C5:F20');
  if Sel.Intersects(ChartData) then
    ShowMessage('Selection overlaps chart data');
end;

Width

Visibility: public
Declaration

Delphi
function Width: Integer;
C++
int __fastcall Width();

Where used: Column count of the range (normalized).

R := TCellRange.FromA1('A1:C1');
Assert(R.Width = 3);

Height

Visibility: public
Declaration

Delphi
function Height: Integer;
C++
int __fastcall Height();

Where used: Row count of the range (normalized).

R := TCellRange.FromA1('A1:A10');
Assert(R.Height = 10);

{ Allocate a buffer for the block }
SetLength(Buf, R.Height);

ToA1

Visibility: public
Declaration

Delphi
function ToA1: string;
C++
System::UnicodeString __fastcall ToA1();

Where used: Logs, formula construction, SheetAPI range strings, UI captions.

How to use:

var
  R: TCellRange;
  S: TAuthoringSheet;
begin
  R := TCellRange.Create(1, 1, 3, 3);
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['D1'].Formula := '=SUM(' + R.ToA1 + ')'; // =SUM(A1:C3)
  Caption := R.ToA1;
end;

TCellValue

Typed cell payload: what a cell is (text, number, bool, error, formula, or empty).

Where used: - Evaluator.Evaluate / EvaluateCell results - OnCellChanged (OldValue / NewValue) - Building values before writing through SheetAPI or core APIs

How to use (pattern): create with a From* factory → check Kind → read the matching field → or call ToDisplayString for a quick label.

Fields

Visibility: public

Field Type Read when
Kind TCellValueKind Always first
Text string cvkText
Number Double cvkNumber
BooleanValue Boolean cvkBoolean
ErrorCode TCellErrorCode cvkError
Formula string cvkFormula (includes leading =)
var V: TCellValue;
begin
  V := MagiXells1.Evaluator.Evaluate('=A1+B1');
  if V.Kind = cvkNumber then
    MagiXells1.Workbook.UseActiveSheet.Cell['C1'].AsNumber := V.Number;
end;

Empty

Visibility: public
Declaration

Delphi
class function Empty: TCellValue; static;
C++
static TCellValue __fastcall Empty();

Where used: Clear a value, initialize locals, or represent “no content” in events.

var V: TCellValue;
begin
  V := TCellValue.Empty;
  Assert(V.IsEmpty);
  { Interactive edit rewrite: blank the cell }
  NewValue := TCellValue.Empty;
end;

FromText

Visibility: public
Declaration

Delphi
class function FromText(const S: string): TCellValue; static;
C++
static TCellValue __fastcall FromText(const System::UnicodeString S);

Where used: Labels, IDs, any non-numeric string cell.

var
  V: TCellValue;
  S: TAuthoringSheet;
begin
  V := TCellValue.FromText('SKU-001');
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].Text := V.Text;
end;

FromNumber

Visibility: public
Declaration

Delphi
class function FromNumber(const N: Double): TCellValue; static;
C++
static TCellValue __fastcall FromNumber(const double N);

Where used: Amounts, quantities, dates-as-serials, evaluator-friendly literals.

V := TCellValue.FromNumber(19.99);
S.Cell['B1'].AsNumber := V.Number;

FromBoolean

Visibility: public
Declaration

Delphi
class function FromBoolean(const B: Boolean): TCellValue; static;
C++
static TCellValue __fastcall FromBoolean(const bool B);

Where used: Flags, checkbox-like cells, formula TRUE/FALSE results.

V := TCellValue.FromBoolean(True);
if V.BooleanValue then
  S.Cell['C1'].Text := 'Yes';

FromError

Visibility: public
Declaration

Delphi
class function FromError(ACode: TCellErrorCode): TCellValue; static;
C++
static TCellValue __fastcall FromError(TCellErrorCode ACode);

Where used: Propagate or inject spreadsheet errors (rare in UI apps; common in formula hosts).

V := TCellValue.FromError(ceNA);
ShowMessage(V.ToDisplayString); // '#N/A'

FromFormula

Visibility: public
Declaration

Delphi
class function FromFormula(const F: string): TCellValue; static;
C++
static TCellValue __fastcall FromFormula(const System::UnicodeString F);

Where used: When you hold a formula string as a TCellValue (e.g. event rewrite). Adds leading = if missing.

How to use:

var V: TCellValue;
begin
  V := TCellValue.FromFormula('SUM(A1:A10)');
  Assert(V.Kind = cvkFormula);
  Assert(V.Formula = '=SUM(A1:A10)');

  { Typical write path still uses SheetAPI }
  MagiXells1.Workbook.UseActiveSheet.Cell['B1'].Formula := V.Formula;
  MagiXells1.Recalculate;
end;

IsEmpty

Visibility: public
Declaration

Delphi
function IsEmpty: Boolean;
C++
bool __fastcall IsEmpty();

Where used: Skip blank cells in exports, stats, or validation.

V := MagiXells1.Evaluator.EvaluateCell(
  MagiXells1.ActiveSheetIndex, 1, 1);
if V.IsEmpty then
  Exit;

ToDisplayString

Visibility: public
Declaration

Delphi
function ToDisplayString: string;
C++
System::UnicodeString __fastcall ToDisplayString();

Where used: Status bars, logs, message boxes — a single string without switching on Kind yourself. Numbers drop trailing zeros; booleans become TRUE/FALSE; errors use ErrorCodeToString; formulas return the formula text (not the calculated result).

How to use:

V := MagiXells1.Evaluator.Evaluate('=1+2*3');
ShowMessage(V.ToDisplayString); // '7'

V := MagiXells1.Evaluator.Evaluate('=1/0');
ShowMessage(V.ToDisplayString); // '#DIV/0!'

Helpers

ColToLetters

Visibility: public
Declaration

Delphi
function ColToLetters(Col: Integer): string;
C++
System::UnicodeString __fastcall ColToLetters(int Col);

Where used: - Default column header captions (1A, 27AA, 16384XFD) - Building A1 references in loops without TCellAddress - UI labels (“Column C”)

Returns '' if Col < 1.

How to use:

{ Mirror what the grid shows in the column header band }
procedure TForm1.ShowColumnCaption(ACol: Integer);
begin
  Label1.Caption := 'Column ' + ColToLetters(ACol);
end;

{ Build A1 in a loop }
for Col := 1 to 5 do
  S.Cell[ColToLetters(Col) + '1'].Text := 'H' + IntToStr(Col);
  { A1..E1 }

LettersToCol

Visibility: public
Declaration

Delphi
function LettersToCol(const S: string): Integer;
C++
int __fastcall LettersToCol(const System::UnicodeString S);

Where used: Parse column letters from user input or split A1 yourself.
Limits: At most 3 letters (XFD). Longer strings return 0 (treated as names, not columns). Invalid characters → 0.

How to use:

function ParseCol(const Letters: string): Integer;
begin
  Result := LettersToCol(Letters);
  if Result = 0 then
    raise Exception.CreateFmt('Invalid column %s (use A..XFD)', [Letters]);
end;

Col := ParseCol('AA'); // 27
Assert(ColToLetters(Col) = 'AA');

ErrorCodeToString

Visibility: public
Declaration

Delphi
function ErrorCodeToString(AError: TCellErrorCode): string;
C++
System::UnicodeString __fastcall ErrorCodeToString(TCellErrorCode AError);

Where used: Display or log TCellValue.ErrorCode / cvkError results.

How to use:

V := MagiXells1.Evaluator.Evaluate('=UNKNOWNFUNC()');
if V.Kind = cvkError then
  Memo1.Lines.Add(ErrorCodeToString(V.ErrorCode)); // e.g. '#NAME?'

FileFormatFromExtension

Visibility: public
Declaration

Delphi
function FileFormatFromExtension(const AFileName: string): TMagiXellsFileFormat;
C++
TMagiXellsFileFormat __fastcall FileFormatFromExtension(const System::UnicodeString AFileName);

Where used: Open/Save dialogs when you need to branch UI or pick stream format before I/O.

Extension Result
.mgx ffMgx
.xlsx, .xlsm ffXlsx
.ods ffOds
.csv ffCsv
other ffAuto

How to use:

procedure TForm1.OpenBtnClick(Sender: TObject);
var
  Fmt: TMagiXellsFileFormat;
begin
  if not OpenDialog1.Execute then
    Exit;
  Fmt := FileFormatFromExtension(OpenDialog1.FileName);
  case Fmt of
    ffCsv:
      ShowMessage('CSV: values only, no formatting');
    ffOds, ffXlsx, ffMgx:
      { full workbook formats };
  else
    { ffAuto — MagiXells will still try by extension on LoadFromFile };
  end;
  MagiXells1.LoadFromFile(OpenDialog1.FileName);
end;

Events

TCellChangedEvent

Visibility: public
Declaration

Delphi
procedure(Sender: TObject; const SheetIndex: Integer; const Address: TCellAddress; const OldValue: TCellValue; var NewValue: TCellValue) of object;
C++
typedef void __fastcall (__closure *)(
  System::TObject* Sender,
  const int SheetIndex,
  const TCellAddress Address,
  const TCellValue OldValue,
  TCellValue& NewValue
);

Where used: Assigned to TMagiXells / TFmxMagiXells.OnCellChanged.

When it fires: Interactive edits (inplace commit, fill, similar UI commits).
When it does not: Programmatic SheetAPI / bulk SetCell writes (by design).

How to use: Inspect Address / OldValue, optionally rewrite NewValue (does not re-enter the event).

procedure TForm1.MagiXells1CellChanged(Sender: TObject; const SheetIndex: Integer;
  const Address: TCellAddress; const OldValue: TCellValue; var NewValue: TCellValue);
begin
  Log(Format('Sheet %d %s: %s → %s',
    [SheetIndex, Address.ToA1,
     OldValue.ToDisplayString, NewValue.ToDisplayString]));

  { Force uppercase text typed by the user }
  if NewValue.Kind = cvkText then
    NewValue := TCellValue.FromText(UpperCase(NewValue.Text));

  { Block edits on column A }
  if Address.Col = 1 then
    NewValue := OldValue;
end;

begin
  MagiXells1.OnCellChanged := MagiXells1CellChanged;
end;

Full control event list: TMagiXells API.


End-to-end examples

1) Fill a header row with column letters

uses MagiXells.Types, MagiXells.SheetAPI;

var
  S: TAuthoringSheet;
  Col: Integer;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  for Col := 1 to 10 do
    S.Cell[ColToLetters(Col) + '1'].Text := ColToLetters(Col);
end;

2) Select a block and summarize with the evaluator

var
  R: TCellRange;
  V: TCellValue;
begin
  R := TCellRange.FromA1('A2:A100');
  MagiXells1.SelectRange(R);
  V := MagiXells1.Evaluator.Evaluate('=SUM(' + R.ToA1 + ')');
  if V.Kind = cvkNumber then
    Caption := Format('Sum = %g', [V.Number])
  else
    Caption := V.ToDisplayString;
end;

3) Open dialog → detect format → load

var
  Fmt: TMagiXellsFileFormat;
begin
  if not OpenDialog1.Execute then Exit;
  Fmt := FileFormatFromExtension(OpenDialog1.FileName);
  if Fmt = ffCsv then
    StatusBar1.SimpleText := 'Loading CSV (values only)';
  MagiXells1.LoadFromFile(OpenDialog1.FileName);
end;

4) Hide helper sheets

var I: Integer;
begin
  for I := 0 to MagiXells1.SheetCount - 1 do
    if SameText(MagiXells1.Workbook.GetSheet(I).Name, '_Meta') then
      MagiXells1.SetSheetVisibility(I, svVeryHidden);
end;

See also

Host options and UiTheme

Shared option objects that configure editing behaviour, view chrome, sheet protection, the sheet tab bar, named formulas, and the host UI theme. Every property hangs off the spreadsheet control — you do not construct these yourself at design time.

Units: MagiXells.HostOptions, MagiXells.UiTheme
C++Builder: #include <MagiXells.HostOptions.hpp> / #include <MagiXells.UiTheme.hpp> — see C++Builder.

Trial/Runtime installs ship compiled packages only (no library .pas). Use this page as the contract for these types.

Property on TMagiXells / TFmxMagiXells Type Unit
Behavior TMagiXellsBehaviorOptions MagiXells.HostOptions
ViewOptions TMagiXellsViewOptions MagiXells.HostOptions
Protection TMagiXellsProtectionOptions MagiXells.HostOptions
TabBar TMagiXellsTabBarOptions MagiXells.HostOptions
NamedRanges TMagiXellsNamedRanges MagiXells.HostOptions
Appearance TMagiXellsUiTheme MagiXells.UiTheme

All members below are public or published as noted. Colors are TColor (COLORREF / BGR $00BBGGRR).

uses
  MagiXells.HostOptions,
  MagiXells.UiTheme,
  MagiXells.Spreadsheet;   { or MagiXells.Spreadsheet.Fmx }

begin
  MagiXells1.Behavior.AllowPaste := False;
  MagiXells1.ViewOptions.ShowFormulas := True;
  MagiXells1.Appearance.Preset := utpExcelDarkGray;
  MagiXells1.NamedRanges.AddOrSet('Sales', 'Sheet1!$A$1:$B$10');
end;

See also RTL & themes and TMagiXells.


Enumerations

TMagiXellsEnterMoves

Visibility: public
Declaration

Delphi
TMagiXellsEnterMoves = (emDown, emRight, emNone);
C++
enum class TMagiXellsEnterMoves { emDown, emRight, emNone };
Value Meaning
emDown After Enter commits an edit, move the active cell down (Excel default)
emRight Move right instead
emNone Stay on the same cell

Where used: Behavior.EnterMoves — keyboard data-entry flow when the user presses Enter to finish in-cell or formula-bar editing.

How to use:

{ Horizontal entry across a form row }
MagiXells1.Behavior.EnterMoves := emRight;

{ Locked template cells — commit but do not advance }
MagiXells1.Behavior.EnterMoves := emNone;

TMagiXellsUiThemePreset

Visibility: public
Declaration

Delphi
TMagiXellsUiThemePreset = (utpExcelLight, utpExcelDark, utpMagiXellsBrand, utpExcelDarkGray);
C++
enum class TMagiXellsUiThemePreset { utpExcelLight, utpExcelDark, utpMagiXellsBrand, utpExcelDarkGray };
Value Meaning
utpExcelLight Classic light Excel chrome (default)
utpExcelDark Office Black–style chrome: near-black UI, white worksheet, pale 1px gridlines, Excel-green selection
utpMagiXellsBrand MagiXells brand palette
utpExcelDarkGray Same white sheet as dark, with medium charcoal chrome

Where used: Published as Appearance.Preset for the Object Inspector. Setting it calls ApplyPreset. Declare/stream order puts Preset before individual colors so DFM/FMX can apply the palette, then keep color overrides.

How to use:

MagiXells1.Appearance.Preset := utpExcelDarkGray;

{ Same effect without changing the streamed Preset field first }
MagiXells1.Appearance.ApplyPreset(utpExcelDark);

TMagiXellsBehaviorOptions

Editing and interaction gates for the grid. Accessed as MagiXells1.Behavior.

Owned by the control — do not free. Changes fire OnChanged so the host can refresh UI.

Create

Visibility: public
Declaration

Delphi
constructor Create(AOwner: TPersistent);
C++
__fastcall Create(TPersistent* AOwner);

Where used: Called by TMagiXells / TFmxMagiXells at construction. Hosts never need this unless they build a standalone options object for Assign.

How to use:

{ Prefer the live instance on the control }
MagiXells1.Behavior.AllowEdit := False;

{ Optional: copy a snapshot into another control }
OtherGrid.Behavior.Assign(MagiXells1.Behavior);

OnChanged

Visibility: public
Declaration

Delphi
property OnChanged: TNotifyEvent;
C++
__property TNotifyEvent OnChanged;

Where used: React when any published Behaviour flag changes (toolbar enablement, status text). The spreadsheet already wires its own handler; assign yours only if you need app-level side effects.

How to use:

procedure TForm1.BehaviorChanged(Sender: TObject);
begin
  btnPaste.Enabled := MagiXells1.Behavior.AllowPaste;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  MagiXells1.Behavior.OnChanged := BehaviorChanged;
end;

AllowEdit

Visibility: published
Declaration

Delphi
property AllowEdit: Boolean … default True;
C++
__property Boolean … AllowEdit;

Where used: Master switch for in-cell / formula-bar editing. Turn off for read-only viewers while still allowing selection and copy.

How to use:

MagiXells1.Behavior.AllowEdit := False;  { view-only sheet }

AllowDelete

Visibility: published
Declaration

Delphi
property AllowDelete: Boolean … default True;
C++
__property Boolean … AllowDelete;

Where used: Gates Delete / Clear cell contents from the UI. Useful for locked templates where values must stay.

How to use:

MagiXells1.Behavior.AllowDelete := False;

AllowInsert

Visibility: published
Declaration

Delphi
property AllowInsert: Boolean … default True;
C++
__property Boolean … AllowInsert;

Where used: Gates insert row/column (and related insert UI). Pair with Protection.ProtectStructure when the workbook layout must not change.

How to use:

MagiXells1.Behavior.AllowInsert := False;

AllowFormat

Visibility: published
Declaration

Delphi
property AllowFormat: Boolean … default True;
C++
__property Boolean … AllowFormat;

Where used: Gates user-driven formatting (fonts, fills, borders from the host UI). SheetAPI / code can still format cells.

How to use:

MagiXells1.Behavior.AllowFormat := False;

AllowCopy

Visibility: published
Declaration

Delphi
property AllowCopy: Boolean … default True;
C++
__property Boolean … AllowCopy;

Where used: Gates Ctrl+C / Copy. Disable when the sheet contains sensitive values that must not leave the process via clipboard.

How to use:

MagiXells1.Behavior.AllowCopy := False;

AllowPaste

Visibility: published
Declaration

Delphi
property AllowPaste: Boolean … default True;
C++
__property Boolean … AllowPaste;

Where used: Gates Ctrl+V and Paste* commands. Common for dashboards that accept keyboard navigation but not clipboard injection.

How to use:

MagiXells1.Behavior.AllowPaste := False;  { block Ctrl+V and Paste* }

AllowRichTextEdit

Visibility: published
Declaration

Delphi
property AllowRichTextEdit: Boolean … default True;
C++
__property Boolean … AllowRichTextEdit;

Where used: When False, the in-cell rich-text mini-bar is hidden and Ctrl+B/I/U formatting shortcuts are disabled. SheetAPI / code can still set rich text runs.

How to use:

MagiXells1.Behavior.AllowRichTextEdit := False;

AllowDragFill

Visibility: published
Declaration

Delphi
property AllowDragFill: Boolean … default True;
C++
__property Boolean … AllowDragFill;

Where used: Gates the fill-handle drag (auto-fill series / copy pattern). Disable when accidental fills would corrupt calculated ranges.

How to use:

MagiXells1.Behavior.AllowDragFill := False;

AllowDragMove

Visibility: published
Declaration

Delphi
property AllowDragMove: Boolean … default True;
C++
__property Boolean … AllowDragMove;

Where used: Gates drag-move of a selection to a new location. Disable for forms where cells must stay put.

How to use:

MagiXells1.Behavior.AllowDragMove := False;

FormulaAutoComplete

Visibility: published
Declaration

Delphi
property FormulaAutoComplete: Boolean … default True;
C++
__property Boolean … FormulaAutoComplete;

Where used: Shows function-name completion while typing formulas. Turn off for minimal UIs or when you host your own formula helper.

How to use:

MagiXells1.Behavior.FormulaAutoComplete := True;

AutoCalculate

Visibility: published
Declaration

Delphi
property AutoCalculate: Boolean … default True;
C++
__property Boolean … AutoCalculate;

Where used: When True, dependent formulas recalculate after edits. Set False for bulk loads, then call calculate explicitly (or turn it back on) when ready.

How to use:

MagiXells1.Behavior.AutoCalculate := False;
try
  MagiXells1.LoadFromFile('C:\Data\large.xlsx');
finally
  MagiXells1.Behavior.AutoCalculate := True;
end;

HistoryEnabled

Visibility: published
Declaration

Delphi
property HistoryEnabled: Boolean … default True;
C++
__property Boolean … HistoryEnabled;

Where used: Enables undo/redo history. Disable for high-frequency programmatic writes where undo is meaningless or expensive.

How to use:

MagiXells1.Behavior.HistoryEnabled := False;
try
  { mass SheetAPI writes }
finally
  MagiXells1.Behavior.HistoryEnabled := True;
end;

HistoryLimit

Visibility: published
Declaration

Delphi
property HistoryLimit: Integer … default 100;
C++
__property _di_Integer … HistoryLimit;

Where used: Maximum undo steps retained. Values below 1 are clamped to 1. Raise for power-user editors; lower for memory-constrained hosts.

How to use:

MagiXells1.Behavior.HistoryLimit := 200;

EnterMoves

Visibility: published
Declaration

Delphi
property EnterMoves: TMagiXellsEnterMoves … default emDown;
C++
__property TMagiXellsEnterMoves …* EnterMoves;

Where used: Direction (or none) after Enter commits an edit — see TMagiXellsEnterMoves.

How to use:

MagiXells1.Behavior.EnterMoves := emDown;   { Excel-like }
MagiXells1.Behavior.EnterMoves := emRight;  { form-style row entry }

TMagiXellsViewOptions

What the grid shows and how chrome is sized. Accessed as MagiXells1.ViewOptions.

Owned by the control — do not free.

Create

Visibility: public
Declaration

Delphi
constructor Create(AOwner: TPersistent);
C++
__fastcall Create(TPersistent* AOwner);

Where used: Constructed with the spreadsheet. Hosts use MagiXells1.ViewOptions only.

How to use:

MagiXells1.ViewOptions.GridLines := False;
OtherGrid.ViewOptions.Assign(MagiXells1.ViewOptions);

OnChanged

Visibility: public
Declaration

Delphi
property OnChanged: TNotifyEvent;
C++
__property TNotifyEvent OnChanged;

Where used: Notify your app when view toggles change (menu checkmarks for Gridlines / Headers / Show Formulas).

How to use:

procedure TForm1.ViewOptionsChanged(Sender: TObject);
begin
  miShowFormulas.Checked := MagiXells1.ViewOptions.ShowFormulas;
end;

MagiXells1.ViewOptions.OnChanged := ViewOptionsChanged;

GridLines

Visibility: published
Declaration

Delphi
property GridLines: Boolean … default True;
C++
__property Boolean … GridLines;

Where used: Show or hide cell gridlines. Distinct from cell borders set via formatting.

How to use:

MagiXells1.ViewOptions.GridLines := False;  { print-preview / clean dashboard }

Headers

Visibility: published
Declaration

Delphi
property Headers: Boolean … default True;
C++
__property Boolean … Headers;

Where used: Show or hide row-number and column-letter headers. Hide for kiosk / embedded report views.

How to use:

MagiXells1.ViewOptions.Headers := False;

ShowFormulas

Visibility: published
Declaration

Delphi
property ShowFormulas: Boolean … default False;
C++
__property Boolean … ShowFormulas;

Where used: Display formula text instead of calculated results (Excel Ctrl+` style). Handy for auditing and support tools.

How to use:

MagiXells1.ViewOptions.ShowFormulas := True;

ShowZeros

Visibility: published
Declaration

Delphi
property ShowZeros: Boolean … default True;
C++
__property Boolean … ShowZeros;

Where used: When False, numeric zeros render blank (Excel “Show a zero in cells that have zero value” off).

How to use:

MagiXells1.ViewOptions.ShowZeros := False;

R1C1

Visibility: published
Declaration

Delphi
property R1C1: Boolean … default False;
C++
__property Boolean … R1C1;

Where used: Switch formula / address display toward R1C1 style when your host expects that convention. Default is A1.

How to use:

MagiXells1.ViewOptions.R1C1 := True;

HorzScrollBar

Visibility: published
Declaration

Delphi
property HorzScrollBar: Boolean … default True;
C++
__property Boolean … HorzScrollBar;

Where used: Show the horizontal scrollbar. Hide when the sheet is sized to fit and scrolling is unwanted.

How to use:

MagiXells1.ViewOptions.HorzScrollBar := False;

VertScrollBar

Visibility: published
Declaration

Delphi
property VertScrollBar: Boolean … default True;
C++
__property Boolean … VertScrollBar;

Where used: Show the vertical scrollbar.

How to use:

MagiXells1.ViewOptions.VertScrollBar := True;

GridLineColor

Visibility: published
Declaration

Delphi
property GridLineColor: TColor … default $00D0D0D0;
C++
__property TColor …* GridLineColor;

Where used: Color of the cell gridlines when GridLines is True. Prefer Appearance.GridLine for full themes; this property remains for quick ViewOptions tweaks and stays in sync with paint paths that read ViewOptions.

How to use:

MagiXells1.ViewOptions.GridLineColor := $00D0D0D0;  { TColor / COLORREF BGR }

AutoRowHeight

Visibility: published
Declaration

Delphi
property AutoRowHeight: Boolean … default True;
C++
__property Boolean … AutoRowHeight;

Where used: When True, wrapped / multi-line content can grow row height automatically. Disable to keep fixed row heights only.

How to use:

MagiXells1.ViewOptions.AutoRowHeight := True;

FreezeLineColor

Visibility: published
Declaration

Delphi
property FreezeLineColor: TColor … default $00808080;
C++
__property TColor …* FreezeLineColor;

Where used: Color of the freeze-pane divider lines. Theme presets also set Appearance.FreezeLine.

How to use:

MagiXells1.ViewOptions.FreezeLineColor := $00808080;

SmoothDrawing

Visibility: published
Declaration

Delphi
property SmoothDrawing: Boolean … default True;
C++
__property Boolean … SmoothDrawing;

Where used: VCL: anti-aliased shapes, charts, and ink via GDI+ (cell text stays GDI). Turn off only if you need maximum paint speed on low-end hosts.

How to use:

MagiXells1.ViewOptions.SmoothDrawing := True;

LiveRowColResize

Visibility: published
Declaration

Delphi
property LiveRowColResize: Boolean … default True;
C++
__property Boolean … LiveRowColResize;

Where used: When True, column/row size applies on every drag move. When False, only a guide line is shown until mouse-up (lighter during drag).

How to use:

MagiXells1.ViewOptions.LiveRowColResize := False;  { guide only until mouse-up }

RowHeaderWidth

Visibility: published
Declaration

Delphi
property RowHeaderWidth: Integer … default 40;
C++
__property _di_Integer … RowHeaderWidth;

Where used: Width of the row-number gutter in pixels at 96 DPI (scaled with zoom / screen DPI). Outline levels add extra width on top. Only used when AutoRowHeaderWidth is False.

How to use:

MagiXells1.ViewOptions.AutoRowHeaderWidth := False;
MagiXells1.ViewOptions.RowHeaderWidth := 56;

AutoRowHeaderWidth

Visibility: published
Declaration

Delphi
property AutoRowHeaderWidth: Boolean … default True;
C++
__property Boolean … AutoRowHeaderWidth;

Where used: When True (default) the row-number gutter sizes itself to fit the largest visible row number (1–9, 10–99, 100–999, …). It recalculates as you scroll and as DPI / zoom change. Set False to pin the fixed RowHeaderWidth.

How to use:

{ Compact gutter that grows with the row numbers (default): }
MagiXells1.ViewOptions.AutoRowHeaderWidth := True;

{ Fixed 56 px gutter regardless of row numbers: }
MagiXells1.ViewOptions.AutoRowHeaderWidth := False;
MagiXells1.ViewOptions.RowHeaderWidth := 56;

ColHeaderHeight

Visibility: published
Declaration

Delphi
property ColHeaderHeight: Integer … default 22;
C++
__property _di_Integer … ColHeaderHeight;

Where used: Height of the column-letter header strip in pixels at 96 DPI (scaled with zoom / screen DPI). Outline column levels add extra height on top.

How to use:

MagiXells1.ViewOptions.ColHeaderHeight := 28;

TMagiXellsProtectionOptions

Workbook/sheet structure protection flags for the host UI. Accessed as MagiXells1.Protection.

These complement per-cell locked flags — they do not replace Excel-style password protection in the file format.

Create

Visibility: public
Declaration

Delphi
constructor Create(AOwner: TPersistent);
C++
__fastcall Create(TPersistent* AOwner);

Where used: Owned by the control.

How to use:

MagiXells1.Protection.ProtectStructure := True;

OnChanged

Visibility: public
Declaration

Delphi
property OnChanged: TNotifyEvent;
C++
__property TNotifyEvent OnChanged;

Where used: Sync protection menus / status when flags change.

How to use:

MagiXells1.Protection.OnChanged := ProtectionChanged;

ProtectStructure

Visibility: published
Declaration

Delphi
property ProtectStructure: Boolean … default False;
C++
__property Boolean … ProtectStructure;

Where used: When True, the host treats workbook structure as protected (insert/delete/rename sheet style operations blocked according to the control’s protection rules).

How to use:

MagiXells1.Protection.ProtectStructure := True;

AllowSelectLocked

Visibility: published
Declaration

Delphi
property AllowSelectLocked: Boolean … default True;
C++
__property Boolean … AllowSelectLocked;

Where used: Whether the user may select cells marked locked while protection is in effect. Set False for strict “editable cells only” navigation.

How to use:

MagiXells1.Protection.AllowSelectLocked := False;

AllowSelectUnlocked

Visibility: published
Declaration

Delphi
property AllowSelectUnlocked: Boolean … default True;
C++
__property Boolean … AllowSelectUnlocked;

Where used: Whether unlocked cells remain selectable. Rarely turned off; typically left True so users can edit the unlocked subset.

How to use:

MagiXells1.Protection.AllowSelectUnlocked := True;

AllowFormatCells

Visibility: published
Declaration

Delphi
property AllowFormatCells: Boolean … default False;
C++
__property Boolean … AllowFormatCells;

Where used: When structure/protection is on, whether formatting locked cells is still allowed. Default False matches Excel’s typical protected-sheet behaviour.

How to use:

MagiXells1.Protection.ProtectStructure := True;
MagiXells1.Protection.AllowFormatCells := False;

TMagiXellsTabBarOptions

Sheet tab strip at the bottom of the control. Accessed as MagiXells1.TabBar.

Create

Visibility: public
Declaration

Delphi
constructor Create(AOwner: TPersistent);
C++
__fastcall Create(TPersistent* AOwner);

Where used: Owned by the control.

How to use:

MagiXells1.TabBar.Visible := True;

OnChanged

Visibility: public
Declaration

Delphi
property OnChanged: TNotifyEvent;
C++
__property TNotifyEvent OnChanged;

Where used: Refresh host chrome when tab-bar options change.

How to use:

MagiXells1.TabBar.OnChanged := TabBarChanged;

Visible

Visibility: published
Declaration

Delphi
property Visible: Boolean … default True;
C++
__property Boolean … Visible;

Where used: Show or hide the entire sheet tab bar (single-sheet apps often hide it).

How to use:

MagiXells1.TabBar.Visible := False;  { one-sheet embedded viewer }

ShowNewButton

Visibility: published
Declaration

Delphi
property ShowNewButton: Boolean … default True;
C++
__property Boolean … ShowNewButton;

Where used: Shows the “+” control that inserts a new sheet. Hide when users must not add sheets.

How to use:

MagiXells1.TabBar.ShowNewButton := False;

ShowHiddenSheets

Visibility: published
Declaration

Delphi
property ShowHiddenSheets: Boolean … default False;
C++
__property Boolean … ShowHiddenSheets;

Where used: When True, sheets with Visibility of svHidden or svVeryHidden appear on the tab bar (italic / muted). Clicking them activates the sheet. When turned back off, MagiXells leaves a hidden active sheet for the first visible one. See TSheetVisibility in types.

How to use:

MagiXells1.SetSheetVisibility(1, svHidden);
MagiXells1.TabBar.ShowHiddenSheets := True;  { still list Sheet2 muted }

TMagiXellsNamedRanges

Thin façade over the workbook’s named formulas dictionary. Accessed as MagiXells1.NamedRanges.

Prefer this over reaching into Workbook.NamedFormulas from application code.

Create

Visibility: public
Declaration

Delphi
constructor Create(AWorkbook: TWorkbook);
C++
__fastcall Create(TWorkbook* AWorkbook);

Where used: Constructed by the control with its workbook. Do not free the instance on MagiXells1.

How to use:

{ Always prefer the control property }
MagiXells1.NamedRanges.AddOrSet('TaxRate', '0.2');

SetWorkbook

Visibility: public
Declaration

Delphi
procedure SetWorkbook(AWorkbook: TWorkbook);
C++
void __fastcall SetWorkbook(TWorkbook* AWorkbook);

Where used: Retarget the façade after replacing the workbook instance. The control calls this for you on load/new; call it only if you swapped workbooks manually.

How to use:

MagiXells1.NamedRanges.SetWorkbook(MagiXells1.Workbook);

Count

Visibility: public
Declaration

Delphi
function Count: Integer;
C++
int __fastcall Count();

Where used: How many named formulas exist. Returns 0 if no workbook is attached.

How to use:

StatusBar1.SimpleText := Format('%d named ranges', [MagiXells1.NamedRanges.Count]);

Contains

Visibility: public
Declaration

Delphi
function Contains(const AName: string): Boolean;
C++
bool __fastcall Contains(const System::UnicodeString AName);

Where used: Test before AddOrSet / Remove, or before evaluating a name from user input.

How to use:

if MagiXells1.NamedRanges.Contains('Sales') then
  ShowMessage('Sales is defined')
else
  MagiXells1.NamedRanges.AddOrSet('Sales', 'Sheet1!$A$1:$B$10');

GetFormula

Visibility: public
Declaration

Delphi
function GetFormula(const AName: string): string;
C++
System::UnicodeString __fastcall GetFormula(const System::UnicodeString AName);

Where used: Read the formula/ref string stored for a name (empty string if missing).

How to use:

var
  F: string;
begin
  F := MagiXells1.NamedRanges.GetFormula('Sales');
  { e.g. 'Sheet1!$A$1:$B$10' or a constant like '0.08' }
  Memo1.Lines.Add(F);
end;

AddOrSet

Visibility: public
Declaration

Delphi
procedure AddOrSet(const AName, AFormula: string);
C++
void __fastcall AddOrSet(
  const System::UnicodeString AName,
  const System::UnicodeString AFormula
);

Where used: Define or replace a workbook-scoped name. Formula may be a sheet-qualified absolute range or a constant expression.

How to use:

MagiXells1.NamedRanges.AddOrSet('Sales', 'Sheet1!$A$1:$B$10');
MagiXells1.NamedRanges.AddOrSet('Rate', '0.08');

{ Use from a cell formula }
MagiXells1.Workbook.UseActiveSheet.Cell['C1'].Formula := '=SUM(Sales)*Rate';

Remove

Visibility: public
Declaration

Delphi
procedure Remove(const AName: string);
C++
void __fastcall Remove(const System::UnicodeString AName);

Where used: Delete one name. No-op if missing or no workbook.

How to use:

MagiXells1.NamedRanges.Remove('Sales');

Clear

Visibility: public
Declaration

Delphi
procedure Clear;
C++
void __fastcall Clear();

Where used: Remove all named formulas from the workbook.

How to use:

MagiXells1.NamedRanges.Clear;

Names

Visibility: public
Declaration

Delphi
function Names: TArray<string>;
C++
System::DynamicArray<string> __fastcall Names();

Where used: Enumerate defined names for Name Manager UIs or debugging. Order follows the internal dictionary keys.

How to use:

var
  Arr: TArray<string>;
  I: Integer;
begin
  Arr := MagiXells1.NamedRanges.Names;
  for I := 0 to High(Arr) do
    Memo1.Lines.Add(Arr[I] + ' = ' + MagiXells1.NamedRanges.GetFormula(Arr[I]));
end;

TMagiXellsUiTheme

Host UI chrome theme (grid selection, headers, tabs, editors, charts). Accessed as MagiXells1.Appearance.

Distinct from workbook OOXML theme colors. AI chat colors are not part of this type — use TMagiXellsAIChatTheme on the optional AI chat UI.

Owned by the control. Wrap multi-property edits in BeginUpdate / EndUpdate to avoid redundant repaints.

Create

Visibility: public
Declaration

Delphi
constructor Create(AOwner: TPersistent);
C++
__fastcall Create(TPersistent* AOwner);

Where used: Constructed with the spreadsheet; applies ApplyExcelLight initially.

How to use:

{ Do not create your own for the live grid — use Appearance }
MagiXells1.Appearance.Preset := utpExcelLight;

Preset

Visibility: published
Declaration

Delphi
property Preset: TMagiXellsUiThemePreset … default utpExcelLight;
C++
__property TMagiXellsUiThemePreset …* Preset;

Where used: Object Inspector / DFM theme choice. Changing it calls ApplyPreset and replaces the palette (then streamed color overrides can still apply).

How to use:

MagiXells1.Appearance.Preset := utpExcelDark;

{ Brand look for demos }
MagiXells1.Appearance.Preset := utpMagiXellsBrand;

BeginUpdate

Visibility: public
Declaration

Delphi
procedure BeginUpdate;
C++
void __fastcall BeginUpdate();

Where used: Batch several color/font changes without firing OnChanged / repaint on each setter.

How to use: see EndUpdate.

EndUpdate

Visibility: public
Declaration

Delphi
procedure EndUpdate;
C++
void __fastcall EndUpdate();

Where used: Ends a BeginUpdate block; fires change when the nest count returns to zero.

How to use:

MagiXells1.Appearance.BeginUpdate;
try
  MagiXells1.Appearance.SheetBackground := $00FFFFFF;
  MagiXells1.Appearance.SelectionBorder := $00595959;
  MagiXells1.Appearance.GridLine := $00D0D0D0;
finally
  MagiXells1.Appearance.EndUpdate;
end;

ApplyPreset

Visibility: public
Declaration

Delphi
procedure ApplyPreset(APreset: TMagiXellsUiThemePreset);
C++
void __fastcall ApplyPreset(TMagiXellsUiThemePreset APreset);

Where used: Apply a full palette programmatically (same as setting Preset).

How to use:

MagiXells1.Appearance.ApplyPreset(utpExcelLight);

ApplyExcelLight

Visibility: public
Declaration

Delphi
procedure ApplyExcelLight;
C++
void __fastcall ApplyExcelLight();

Where used: Explicit light Excel palette without going through the enum indirection.

How to use:

MagiXells1.Appearance.ApplyExcelLight;

ApplyExcelDark

Visibility: public
Declaration

Delphi
procedure ApplyExcelDark;
C++
void __fastcall ApplyExcelDark();

Where used: Office Black–style chrome with a white worksheet.

How to use:

MagiXells1.Appearance.ApplyExcelDark;

ApplyExcelDarkGray

Visibility: public
Declaration

Delphi
procedure ApplyExcelDarkGray;
C++
void __fastcall ApplyExcelDarkGray();

Where used: Charcoal chrome + white sheet (softer than full Black).

How to use:

MagiXells1.Appearance.ApplyExcelDarkGray;

ApplyMagiXellsBrand

Visibility: public
Declaration

Delphi
procedure ApplyMagiXellsBrand;
C++
void __fastcall ApplyMagiXellsBrand();

Where used: Product brand chrome for demos and marketing builds.

How to use:

MagiXells1.Appearance.ApplyMagiXellsBrand;

ChartSeriesColor

Visibility: public
Declaration

Delphi
function ChartSeriesColor(AIndex: Integer): TColor;
C++
System::Uitypes::TColor __fastcall ChartSeriesColor(int AIndex);

Where used: Resolve series color by index (AIndex mod 6ChartSeries1ChartSeries6). Use when painting custom chart chrome or matching host legends to MagiXells charts.

How to use:

var
  I: Integer;
  C: TColor;
begin
  for I := 0 to 5 do
  begin
    C := MagiXells1.Appearance.ChartSeriesColor(I);
    { paint legend swatch with C }
  end;
end;

OnChanged

Visibility: public
Declaration

Delphi
property OnChanged: TNotifyEvent;
C++
__property TNotifyEvent OnChanged;

Where used: React to theme edits (preview panes, “reset theme” buttons). The control already listens for repaints.

How to use:

MagiXells1.Appearance.OnChanged := AppearanceChanged;

Grid & header colors

Visibility: published
Signatures:

Property Type Default (utpExcelLight)
SheetBackground TColor $00FFFFFF
GridLine TColor $00D0D0D0
FreezeLine TColor $00808080
HeaderBackground TColor $00F0F0F0
HeaderLine TColor $00C0C0C0
HeaderText TColor $00000000
HeaderSelectedBg TColor $00D6D6D6
HeaderEntireSelectedBg TColor $00C6DFC6

Where used: Worksheet canvas, gridlines, freeze dividers, and row/column header chrome. Prefer a preset first; override these when branding a white-sheet app.

How to use:

MagiXells1.Appearance.BeginUpdate;
try
  MagiXells1.Appearance.Preset := utpExcelLight;
  MagiXells1.Appearance.SheetBackground := $00FFFFFF;
  MagiXells1.Appearance.GridLine := $00C8C8C8;
  MagiXells1.Appearance.HeaderBackground := $00F5F5F5;
  MagiXells1.Appearance.HeaderText := $00333333;
finally
  MagiXells1.Appearance.EndUpdate;
end;

Selection, fill handle & drawings

Visibility: published
Signatures:

Property Type Default
SelectionBorder TColor $00595959
SelectionOverlay TColor $00000000
SelectionOverlayAlpha Byte 40
SelectionBorderWidth Single 2 (from light preset; no published default)
ActiveCellBorder TColor $00595959
ActiveCellBorderWidth Single 2 (from light preset)
FillHandle TColor $002E4921
FillHandleSize Integer 7
FillHandleHalo TColor $00FFFFFF
CommentMarker TColor $000000FF
DrawingSelection TColor $00C65A00
DrawingHandleFace TColor $00FFFFFF
OutlineLine TColor $00777777
GroupButtonFace TColor $00FFFFFF
GroupButtonBorder TColor $00666666
TableHeaderText TColor $00FFFFFF

Where used: Selection rectangle, translucent overlay, active-cell emphasis, drag-fill handle, comment indicators, shape/chart selection handles, outline/group UI, and table header text contrast.

How to use:

MagiXells1.Appearance.BeginUpdate;
try
  MagiXells1.Appearance.SelectionBorder := $00595959;
  MagiXells1.Appearance.SelectionOverlayAlpha := 40;
  MagiXells1.Appearance.ActiveCellBorderWidth := 2;
  MagiXells1.Appearance.FillHandle := $002E4921;
  MagiXells1.Appearance.DrawingSelection := $00C65A00;
finally
  MagiXells1.Appearance.EndUpdate;
end;

AutoFilter colors

Visibility: published
Signatures:

Property Type Default
AutoFilterIdle TColor $00F5F5F5
AutoFilterActive TColor $00F2D5B5
AutoFilterBorder TColor $00808080
AutoFilterGlyph TColor $00222222

Where used: Filter dropdown button face when idle vs filtered, border, and glyph color on table/auto-filter headers.

How to use:

MagiXells1.Appearance.AutoFilterActive := $00F2D5B5;
MagiXells1.Appearance.AutoFilterGlyph := $00222222;

Sheet tab bar colors

Visibility: published
Signatures:

Property Type Default
TabBarBackground TColor $00F0F0F0
TabInactive TColor $00E8E8E8
TabActive TColor $00FFFFFF
TabText TColor $00000000
TabTextMuted TColor $00888888
TabScrollEnabled TColor $00333333
TabScrollDisabled TColor $00AAAAAA

Where used: Bottom sheet tabs and tab-scroll arrows. Muted text is used for hidden sheets when TabBar.ShowHiddenSheets is True. Sheet tab typeface is MagiXells1.SheetTabFont (control TFont), not these colors.

How to use:

MagiXells1.Appearance.BeginUpdate;
try
  MagiXells1.Appearance.TabBarBackground := $00F0F0F0;
  MagiXells1.Appearance.TabActive := $00FFFFFF;
  MagiXells1.Appearance.TabInactive := $00E8E8E8;
finally
  MagiXells1.Appearance.EndUpdate;
end;
MagiXells1.SheetTabFont.Name := 'Segoe UI';
MagiXells1.SheetTabFont.Size := 9;

Scrollbar colors

Visibility: published
Signatures:

Property Type Default
ScrollBarTrack TColor $00F0F0F0
ScrollBarThumb TColor $00C1C1C1
ScrollBarThumbHot TColor $00A8A8A8
ScrollBarThumbPressed TColor $00787878
ScrollBarButton TColor $00F0F0F0
ScrollBarArrow TColor $00606060

Where used: Custom MagiXells scrollbars (not the OS scrollbar). Match these to HostBackground / dark presets for cohesive chrome.

How to use:

MagiXells1.Appearance.ApplyPreset(utpExcelDarkGray);
{ or tweak one channel: }
MagiXells1.Appearance.ScrollBarThumb := $00C1C1C1;

Formula bar, mini-bar, tips & host

Visibility: published
Signatures:

Property Type Default
FormulaBarBackground TColor $00FFFFFF
FormulaBarText TColor $00000000
FormulaBarEditBackground TColor $00FFFFFF
MiniBarBackground TColor $00F0F0F0
MiniBarBorder TColor $00A0A0A0
TipBackground TColor $00E1FFFF
TipBorder TColor $00808080
TipText TColor $00000000
HostBackground TColor $00FFFFFF

Where used: Formula-bar chrome, rich-text mini-bar, tooltip/hint surfaces, and the host control background behind the grid. Formula-bar font is MagiXells1.FormulaBarFont.

How to use:

MagiXells1.Appearance.FormulaBarBackground := $00FFFFFF;
MagiXells1.Appearance.HostBackground := $00FFFFFF;
MagiXells1.FormulaBarFont.Name := 'Segoe UI';
MagiXells1.FormulaBarFont.Size := 9;

In-place editor colors

Visibility: published
Signatures:

Property Type Default
EditorBackground TColor $00FFFFFF
EditorText TColor $00000000
EditorSelection TColor $00FFD6B4
EditorFocusRing TColor $00FFBF00
EditorCaret TColor $00000000

Where used: In-cell / formula edit control while typing. Keep contrast high on dark presets (presets already adjust these).

How to use:

MagiXells1.Appearance.EditorSelection := $00FFD6B4;
MagiXells1.Appearance.EditorFocusRing := $00FFBF00;

Theme fonts (header / code / chart)

Visibility: published
Signatures:

Property Type Light-preset value
HeaderFontName string 'Segoe UI'
HeaderFontSize Single 9
CodeFontName string 'Consolas'
CodeFontSize Single 8
ChartFontName string 'Calibri'
ChartTitleSize Single 14
ChartLabelSize Single 9

Where used: Row/column header typeface, monospace for code-like UI, and chart title/label sizes. Formula bar and sheet tabs use control-level FormulaBarFont / SheetTabFont instead.

How to use:

MagiXells1.Appearance.BeginUpdate;
try
  MagiXells1.Appearance.HeaderFontName := 'Segoe UI';
  MagiXells1.Appearance.HeaderFontSize := 9;
  MagiXells1.Appearance.CodeFontName := 'Consolas';
  MagiXells1.Appearance.ChartFontName := 'Calibri';
  MagiXells1.Appearance.ChartTitleSize := 14;
finally
  MagiXells1.Appearance.EndUpdate;
end;
MagiXells1.FormulaBarFont.Name := 'Segoe UI';
MagiXells1.SheetTabFont.Name := 'Segoe UI';

Chart colors

Visibility: published
Signatures: (defaults are COLORREF/BGR; Office #4472C4 is stored as $C47244)

Property Type Default
ChartSeries1 TColor $C47244
ChartSeries2 TColor $317DED
ChartSeries3 TColor $A5A5A5
ChartSeries4 TColor $00C0FF
ChartSeries5 TColor $D59B5B
ChartSeries6 TColor $47AD70
ChartAxis TColor $D9D9D9
ChartGrid TColor $D9D9D9
ChartLabel TColor $595959
ChartPlotBackground TColor $FFFFFF
ChartPlaceholderBg TColor $F2F2F2
ChartPlaceholderBorder TColor $808080
ChartSelectionOuter TColor $00C65A00
ChartSelectionInner TColor $00F0B070

Where used: Default series palette and chart chrome for MagiXells chart paint. Override after a preset when your host brand needs fixed series colors. Index via ChartSeriesColor.

How to use:

MagiXells1.Appearance.BeginUpdate;
try
  MagiXells1.Appearance.ApplyExcelLight;
  MagiXells1.Appearance.ChartSeries1 := $C47244;  { #4472C4 as COLORREF }
  MagiXells1.Appearance.ChartSeries2 := $317DED;  { #ED7D31 }
  MagiXells1.Appearance.ChartPlotBackground := $00FFFFFF;
finally
  MagiXells1.Appearance.EndUpdate;
end;

Unit-level helpers (MagiXells.UiTheme)

ColorRefToARGB

Visibility: public (unit function)
Declaration

Delphi
function ColorRefToARGB(Color: TColor; Alpha: Byte = 255): Cardinal;
C++
unsigned __fastcall ColorRefToARGB(
  System::Uitypes::TColor Color,
  System::Byte Alpha = 255
);

Where used: Convert MagiXells TColor (BGR) to FMX TAlphaColor / $AARRGGBB for custom FMX overlays that must match Appearance.

How to use:

uses MagiXells.UiTheme;

var
  ARGB: Cardinal;
begin
  ARGB := ColorRefToARGB(MagiXells1.Appearance.SheetBackground);
  { FMX: MyRect.Fill.Color := TAlphaColor(ARGB); }
end;

MagiXellsDefaultUiTheme

Visibility: public
Declaration

Delphi
function MagiXellsDefaultUiTheme: TMagiXellsUiTheme;
C++
TMagiXellsUiTheme* __fastcall MagiXellsDefaultUiTheme();

Where used: Process-wide fallback theme (lazy ApplyExcelLight) when no control has set an active theme. Read-only reference for paint helpers — do not free it.

How to use:

var
  T: TMagiXellsUiTheme;
begin
  T := MagiXellsDefaultUiTheme;
  Assert(T.SheetBackground = $00FFFFFF);
end;

ActiveUiTheme

Visibility: public
Declaration

Delphi
function ActiveUiTheme: TMagiXellsUiTheme;
C++
TMagiXellsUiTheme* __fastcall ActiveUiTheme();

Where used: Theme currently bound for synchronous paint (renderer / charts). Returns MagiXellsDefaultUiTheme when none is set.

How to use:

C := ActiveUiTheme.GridLine;

SetActiveUiTheme

Visibility: public
Declaration

Delphi
procedure SetActiveUiTheme(ATheme: TMagiXellsUiTheme);
C++
void __fastcall SetActiveUiTheme(TMagiXellsUiTheme* ATheme);

Where used: Point paint paths at a specific control’s Appearance during a paint/export pass. The spreadsheet sets this for you; call only in custom render hosts.

How to use:

SetActiveUiTheme(MagiXells1.Appearance);
try
  { custom paint that reads ActiveUiTheme }
finally
  SetActiveUiTheme(nil);  { fall back to MagiXellsDefaultUiTheme }
end;

See also

SheetAPI

Ergonomic authoring façade over a workbook + worksheet: A1-addressed Cell / Range, formatting, drawings, tables, pivots, sort, validation, and workbook name/style helpers.

Unit: MagiXells.SheetAPI
Colors: MagiXells.SheetAPI.ColorsSheetClDefault and SheetColorToRef / SheetRefToColor (sentinel “use format default” color for optional TColor parameters).
C++Builder: #include <MagiXells.SheetAPI.hpp> — Delphi class helpers (Sheet.Cell['A1'], Workbook.UseActiveSheet) are not available in C++. Use TSheetCellRef::Create, TSheetRangeRef::Create, TAuthoringSheet::Create, and TWorkbookNamesFacade::Create — see C++Builder.

Trial/Runtime installs ship compiled packages only (no library .pas). Use this page as the contract.

All members below are public (records and helpers have no published section).

uses
  MagiXells.Types,
  MagiXells.Spreadsheet,   { or MagiXells.Spreadsheet.Fmx }
  MagiXells.SheetAPI,
  MagiXells.SheetAPI.Colors;

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].Text := 'Hello';
  S.Cell['B1'].AsNumber := 42;
  S.Range('A1:B1').BorderAround(blsThin);
end;

Indexing conventions

Surface Indexing
Cell['A1'], Range('A1:C10'), formulas, print area, freeze anchors Excel A1 strings
TCellAddress / core sheet storage 1-based (Col/Row 1 = A / first row) — see types
SetColWidthChars, SetRowHeightPt, Get*, HideRows/HideColumns, outline levels, AutoFit* 1-based column/row (1 = A / row 1). Same map as core sizing. Not the control’s 0-based SelectRange
Sort key Col Absolute 1-based sheet column, or 1-based offset within the sorted range (1 = leftmost). 0 is invalid as a relative offset and falls back to the leftmost column
InsertRows / DeleteRows / InsertColumns / DeleteColumns 1-based start row/column
Freeze(ARows, ACols) Counts of frozen panes (0 = none), not A1
UseSheet(AIndex), GetChart / GetPicture / Delete* drawing indexes 0-based
Pivot TPivotFieldRef.Create(AField, …) 0-based field index into the pivot cache

Prefer A1 + UseActiveSheet in application code. Prefer numeric 1-based indexes only for sizing / insert / sort keys.


Types

TSheetHAlign

Visibility: public
Declaration

Delphi
TSheetHAlign = MagiXells.CellFormat.THorizontalAlignment;
{ haGeneral, haLeft, haCenter, haRight, haFill, haJustify }
C++
typedef MagiXells::CellFormat::THorizontalAlignment TSheetHAlign;
/* haGeneral, haLeft, haCenter, haRight, haFill, haJustify */

Where used: TSheetCellRef.HorizontalAlignment and TSheetRangeRef.HorizontalAlignment (avoids clashing with System.Classes names in some units).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].HorizontalAlignment := haCenter;
  S.Range('A1:C1').HorizontalAlignment := haRight;
end;

TSheetVAlign

Visibility: public
Declaration

Delphi
TSheetVAlign = MagiXells.CellFormat.TVerticalAlignment;
{ vaTop, vaCenter, vaBottom }
C++
typedef MagiXells::CellFormat::TVerticalAlignment TSheetVAlign;
/* vaTop, vaCenter, vaBottom */

Where used: Vertical cell alignment on cell/range refs (same clash-avoidance reason as TSheetHAlign).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].VerticalAlignment := vaCenter;
end;

TRichFlag

Visibility: public
Declaration

Delphi
TRichFlag = (rfBold, rfItalic, rfUnderline, rfStrikeout);
C++
enum class TRichFlag { rfBold, rfItalic, rfUnderline, rfStrikeout };

Where used: Flags for RichRun, AddRun, and rich-text construction. Combine into a TRichFlags set.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].AddRun('Hi', [rfBold, rfItalic]);
end;

TRichFlags

Visibility: public
Declaration

Delphi
TRichFlags = set of TRichFlag;
C++
typedef System::Set<TRichFlag, TRichFlag::Low, TRichFlag::High> TRichFlags;

Where used: Parameter type for rich-text helpers (AddRun, RichRun).

How to use:

var
  Flags: TRichFlags;
  S: TAuthoringSheet;
begin
  Flags := [rfBold, rfUnderline];
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].AddRun('Title', Flags);
end;

TBorderSideKind

Visibility: public
Declaration

Delphi
TBorderSideKind = (bsLeft, bsTop, bsRight, bsBottom);
C++
enum class TBorderSideKind { bsLeft, bsTop, bsRight, bsBottom };

Where used: SetBorder on a cell or range when you need one side (use BorderAround / BorderInside for boxes/grids).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].SetBorder(bsBottom, blsThin, TColor($000000));
end;

TSheetSortKey

Visibility: public
Declaration

Delphi
TSheetSortKey = record
  Col: Integer;       { 1-based absolute col, or 1-based offset in range }
  Ascending: Boolean;
end;
C++
struct TSheetSortKey
{
  int Col; /* 1-based absolute col, or 1-based offset in range */
  bool Ascending;
};

Where used: Multi-key TAuthoringSheet.Sort and MagiXellsSortRange. Resolution order: if Col lies inside the range’s absolute columns, treat as absolute; else if 1..ColCount, treat as offset from the range’s left; else fall back to leftmost.

How to use:

var
  S: TAuthoringSheet;
  Keys: TArray<TSheetSortKey>;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  SetLength(Keys, 2);
  Keys[0].Col := 1;          { first column of A1:C10 (= A) }
  Keys[0].Ascending := True;
  Keys[1].Col := 3;          { third column of the range (= C) }
  Keys[1].Ascending := False;
  S.Sort('A1:C10', Keys, True);
end;

MagiXells.SheetAPI.Colors

SheetClDefault

Visibility: public
Declaration

Delphi
const SheetClDefault = TColor($20000000);
C++
const System::Uitypes::TColor SheetClDefault = static_cast<System::Uitypes::TColor>($20000000);

Where used: Optional TColor parameters (SetBorder, AddRun, conditional format fills, shapes). Means “do not override / use format default,” matching VCL clDefault when VCL is not linked.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  { Omit color → SheetClDefault }
  S.Cell['A1'].BorderAround(blsThin);
  S.Cell['A1'].AddRun('plain');  { default color }
  S.Cell['A1'].AddRun('red', [], TColor($0000FF));
end;

SheetColorToRef / SheetRefToColor / SheetColorToBGR

Visibility: public
Declaration

Delphi
function SheetColorToRef(AColor: TColor): TColorRef;
function SheetRefToColor(const ARef: TColorRef): TColor;
function SheetColorToBGR(AColor: TColor): Cardinal;
C++
TColorRef* __fastcall SheetColorToRef(System::Uitypes::TColor AColor);
System::Uitypes::TColor __fastcall SheetRefToColor(const TColorRef* ARef);
unsigned __fastcall SheetColorToBGR(System::Uitypes::TColor AColor);

Where used: Rarely needed in host apps; SheetAPI uses these internally. Useful if you bridge TColor UI pickers to core TColorRef formats.

How to use:

var
  Ref: TColorRef;
  C: TColor;
begin
  Ref := SheetColorToRef(TColor($1F4E79));
  C := SheetRefToColor(Ref);
end;

TSheetCellRef

Bound to one worksheet cell (A1 or TCellAddress). Prefer S.Cell['A1'] in Delphi; in C++Builder use TSheetCellRef::Create.

Create

Visibility: public
Declaration

Delphi
class function Create(ASheet: TWorksheet; const A1: string): TSheetCellRef; static;
C++
static TSheetCellRef __fastcall Create(
  TWorksheet* ASheet,
  const System::UnicodeString A1
);

Where used: Explicit construction without class helpers (required in C++Builder; also useful when you already hold a TWorksheet).

How to use:

var
  C: TSheetCellRef;
begin
  C := TSheetCellRef.Create(MagiXells1.ActiveSheet, 'B2');
  C.AsNumber := 42;
end;

CreateAddr

Visibility: public
Declaration

Delphi
class function CreateAddr(ASheet: TWorksheet; const AAddr: TCellAddress): TSheetCellRef; static;
C++
static TSheetCellRef __fastcall CreateAddr(
  TWorksheet* ASheet,
  const TCellAddress AAddr
);

Where used: When you already have a 1-based TCellAddress (events, loops, hit-testing) and want SheetAPI property setters.

How to use:

var
  C: TSheetCellRef;
  Addr: TCellAddress;
begin
  Addr := TCellAddress.Create(1, 1);  { A1 — 1-based }
  C := TSheetCellRef.CreateAddr(MagiXells1.ActiveSheet, Addr);
  C.Text := 'Corner';
end;

Value

Visibility: public
Declaration

Delphi
property Value: Variant;
C++
__property Variant Value;

Where used: Write/read mixed types without picking Text / AsNumber / AsBoolean. Empty/null variants clear toward empty; numerics/booleans/text map to typed cell values. Prefer typed properties when the kind is known.

How to use:

var
  S: TAuthoringSheet;
  V: Variant;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].Value := 'Text';
  S.Cell['A2'].Value := 3.14;
  S.Cell['A3'].Value := True;
  V := S.Cell['A1'].Value;
end;

Formula

Visibility: public
Declaration

Delphi
property Formula: string;
C++
__property System::UnicodeString Formula;

Where used: Assign Excel-style formulas (leading =). Reading returns the formula text, not the calculated value — use the evaluator or displayed cell value for results.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].AsNumber := 10;
  S.Cell['B1'].AsNumber := 3;
  S.Cell['C1'].Formula := '=A1+B1';
  MagiXells1.Recalculate;
end;

Text

Visibility: public
Declaration

Delphi
property Text: string;
C++
__property System::UnicodeString Text;

Where used: Store plain string labels. Does not parse formulas; use Formula for =…. For multi-run rich text, use SetHtml / AddRun instead.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].Text := 'Label';
end;

AsNumber

Visibility: public
Declaration

Delphi
property AsNumber: Double;
C++
__property double AsNumber;

Where used: Numeric cells (amounts, measures). Pair with NumberFormat for display.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['B1'].AsNumber := 100;
  S.Cell['B1'].NumberFormat := '#,##0.00';
end;

AsBoolean

Visibility: public
Declaration

Delphi
property AsBoolean: Boolean;
C++
__property bool AsBoolean;

Where used: Boolean cells (flags, Yes/No data).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['C1'].AsBoolean := True;
end;

NumberFormat

Visibility: public
Declaration

Delphi
property NumberFormat: string;
C++
__property System::UnicodeString NumberFormat;

Where used: Excel number-format codes (0.00, 0%, yyyy-mm-dd, …). Affects display, not the stored numeric value.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['B1'].AsNumber := 0.156;
  S.Cell['B1'].NumberFormat := '0.00%';
end;

FontName

Visibility: public
Declaration

Delphi
property FontName: string;
C++
__property System::UnicodeString FontName;

Where used: Cell font family.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].FontName := 'Calibri';
end;

FontSize

Visibility: public
Declaration

Delphi
property FontSize: Single;
C++
__property float FontSize;

Where used: Font size in points (not pixels). See measurement units.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].FontSize := 12;
end;

FontBold

Visibility: public
Declaration

Delphi
property FontBold: Boolean;
C++
__property bool FontBold;

Where used: Bold on/off for the cell’s primary font (rich runs may override per run).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].FontBold := True;
end;

FontItalic

Visibility: public
Declaration

Delphi
property FontItalic: Boolean;
C++
__property bool FontItalic;

Where used: Italic on/off for the cell font.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].FontItalic := True;
end;

FontUnderline

Visibility: public
Declaration

Delphi
property FontUnderline: Boolean;
C++
__property bool FontUnderline;

Where used: Single underline on/off for the cell font.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].FontUnderline := True;
end;

FontColor

Visibility: public
Declaration

Delphi
property FontColor: TColor;
C++
__property System::Uitypes::TColor FontColor;

Where used: RGB font color. For theme-tint colors, prefer FontColorTheme.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].FontColor := TColor($1F4E79);
end;

FillColor

Visibility: public
Declaration

Delphi
property FillColor: TColor;
C++
__property System::Uitypes::TColor FillColor;

Where used: Solid fill background. Clear with ClearFill. Theme fills: FillThemeColor.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].FillColor := TColor($D6EAF8);
end;

HorizontalAlignment

Visibility: public
Declaration

Delphi
property HorizontalAlignment: TSheetHAlign;
C++
__property TSheetHAlign HorizontalAlignment;

Where used: Horizontal alignment of cell content.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].HorizontalAlignment := haCenter;
end;

VerticalAlignment

Visibility: public
Declaration

Delphi
property VerticalAlignment: TSheetVAlign;
C++
__property TSheetVAlign VerticalAlignment;

Where used: Vertical alignment inside the row height.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].VerticalAlignment := vaCenter;
end;

WrapText

Visibility: public
Declaration

Delphi
property WrapText: Boolean;
C++
__property bool WrapText;

Where used: Enable wrapping; often combined with taller rows (SetRowHeightPt / AutoFitRow).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].Text := 'Long label that should wrap';
  S.Cell['A1'].WrapText := True;
  S.AutoFitRow(1);  { 1-based row }
end;

StyleIndex

Visibility: public
Declaration

Delphi
property StyleIndex: Integer;
C++
__property int StyleIndex;

Where used: Assign a workbook style-sheet index from Workbook.Styles.Add. Prefer when many cells share one format.

How to use:

var
  S: TAuthoringSheet;
  Idx: Integer;
  Fmt: TCellFormat;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  Fmt := MagiXells1.GetActiveCellFormat;
  Idx := MagiXells1.Workbook.Styles.Add(Fmt);
  S.Cell['A1'].StyleIndex := Idx;
end;

PlainText

Visibility: public
Declaration

Delphi
property PlainText: string; { read-only }
C++
__property System::UnicodeString PlainText;

Where used: Concatenated text of rich runs (or plain cell text). Use when exporting or searching without HTML.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  if S.Cell['A1'].HasRichText then
    ShowMessage(S.Cell['A1'].PlainText);
end;

HasRichText

Visibility: public
Declaration

Delphi
property HasRichText: Boolean; { read-only }
C++
__property bool HasRichText;

Where used: Detect multi-run cells before calling PlainText / Html / ClearRichText.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  if S.Cell['A1'].HasRichText then
    S.Cell['A1'].ClearRichText;
end;

ClearFill

Visibility: public
Declaration

Delphi
procedure ClearFill;
C++
void __fastcall ClearFill();

Where used: Remove solid/theme fill without clearing values or other format.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].ClearFill;
end;

Clear

Visibility: public
Declaration

Delphi
procedure Clear;
C++
void __fastcall Clear();

Where used: Clear value and formats for the cell (stronger than ClearContents / ClearFormats alone).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].Clear;
end;

ClearContents

Visibility: public
Declaration

Delphi
procedure ClearContents;
C++
void __fastcall ClearContents();

Where used: Remove value/formula but keep formatting.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].ClearContents;
end;

ClearFormats

Visibility: public
Declaration

Delphi
procedure ClearFormats;
C++
void __fastcall ClearFormats();

Where used: Strip formatting; leave value/formula.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].ClearFormats;
end;

ApplyFormat

Visibility: public
Declaration

Delphi
procedure ApplyFormat(const AFormat: TCellFormat);
C++
void __fastcall ApplyFormat(const TCellFormat AFormat);

Where used: Apply a full TCellFormat snapshot (from styles, clipboard, or GetActiveCellFormat).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].ApplyFormat(MagiXells1.GetActiveCellFormat);
end;

SetBorder

Visibility: public
Declaration

Delphi
procedure SetBorder(ASide: TBorderSideKind; AStyle: TBorderLineStyle; AColor: TColor = SheetClDefault);
C++
void __fastcall SetBorder(
  TBorderSideKind ASide,
  TBorderLineStyle AStyle,
  System::Uitypes::TColor AColor = SheetClDefault
);

Where used: One border side. TBorderLineStyle includes blsThin, blsMedium, blsHair, …

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].SetBorder(bsBottom, blsMedium, TColor($000000));
end;

BorderAround

Visibility: public
Declaration

Delphi
procedure BorderAround(AStyle: TBorderLineStyle; AColor: TColor = SheetClDefault);
C++
void __fastcall BorderAround(
  TBorderLineStyle AStyle,
  System::Uitypes::TColor AColor = SheetClDefault
);

Where used: Box border on all four sides of the cell.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].BorderAround(blsThin);
end;

FontColorTheme

Visibility: public
Declaration

Delphi
procedure FontColorTheme(AThemeIndex: Integer; ATint: Double = 0);
C++
void __fastcall FontColorTheme(int AThemeIndex, double ATint = 0);

Where used: Theme font color + tint (Excel-compatible), instead of a fixed RGB FontColor.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].FontColorTheme(1, 0);
end;

FillThemeColor

Visibility: public
Declaration

Delphi
procedure FillThemeColor(AThemeIndex: Integer; ATint: Double = 0);
C++
void __fastcall FillThemeColor(int AThemeIndex, double ATint = 0);

Where used: Theme fill + tint (negative tint darkens).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].FillThemeColor(4, -0.1);
end;

SetRichText

Visibility: public
Declaration

Delphi
procedure SetRichText(const ARuns: TRichTextRuns);
C++
void __fastcall SetRichText(const TRichTextRuns* ARuns);

Where used: Replace the cell’s rich runs in one shot (built with RichRun / HtmlToRichText).

How to use:

var
  S: TAuthoringSheet;
  Runs: TRichTextRuns;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  SetLength(Runs, 1);
  Runs[0] := RichRun('Hello', [rfBold]);
  S.Cell['A1'].SetRichText(Runs);
end;

SetHtml

Visibility: public
Declaration

Delphi
procedure SetHtml(const AHtml: string);
C++
void __fastcall SetHtml(const System::UnicodeString AHtml);

Where used: Parse a simple HTML fragment into rich runs (<b>, <i>, <u>, <s>, <span style="…">, <font>, <br>).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].SetHtml('<b>Bold</b> and <i>italic</i>');
end;

Html

Visibility: public
Declaration

Delphi
property Html: string read GetHtml write SetHtml;
C++
__property System::UnicodeString Html;

Where used: Same as SetHtml / round-trip rich text to a simple HTML string.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A2'].Html := '<span style="color:#FF0000">Red</span> text';
  Caption := S.Cell['A2'].Html;
end;

AddRun (flags)

Visibility: public
Declaration

Delphi
procedure AddRun(const AText: string; Flags: TRichFlags = []; AColor: TColor = SheetClDefault; const AFontName: string = ''; ASize: Single = 0); overload;
C++
void __fastcall AddRun(
  const System::UnicodeString AText,
  TRichFlags Flags = [],
  System::Uitypes::TColor AColor = SheetClDefault,
  const System::UnicodeString AFontName = L"",
  float ASize = 0
) /* overload */;

Where used: Append a rich run; call multiple times to build mixed formatting. ASize is points; 0 keeps default size.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].ClearRichText;
  S.Cell['A1'].AddRun('Bold ', [rfBold]);
  S.Cell['A1'].AddRun('plain');
end;

AddRun (font)

Visibility: public
Declaration

Delphi
procedure AddRun(const AText: string; const AFont: TCellFontInfo); overload;
C++
void __fastcall AddRun(
  const System::UnicodeString AText,
  const TCellFontInfo AFont
) /* overload */;

Where used: Append a run with a full font info record from RichFont.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].AddRun('Styled', RichFont('Arial', 11, True));
end;

ClearRichText

Visibility: public
Declaration

Delphi
procedure ClearRichText;
C++
void __fastcall ClearRichText();

Where used: Remove rich runs (cell may remain with plain value depending on prior state). Call before rebuilding runs with AddRun.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].ClearRichText;
end;

TSheetRangeRef

Operates on every cell in an A1 range. Value / Formula use top-left semantics on read; writes broadcast to all cells unless you use SetValues / SetFormulas.

Create

Visibility: public
Declaration

Delphi
class function Create(ASheet: TWorksheet; const A1: string): TSheetRangeRef; static;
C++
static TSheetRangeRef __fastcall Create(
  TWorksheet* ASheet,
  const System::UnicodeString A1
);

Where used: Explicit range binding (C++Builder; or when you have a raw TWorksheet).

How to use:

var
  R: TSheetRangeRef;
begin
  R := TSheetRangeRef.Create(MagiXells1.ActiveSheet, 'A1:D10');
  R.FontBold := True;
end;

Value

Visibility: public
Declaration

Delphi
property Value: Variant;
C++
__property Variant Value;

Where used: Write the same variant into every cell; read returns the top-left cell’s value. Prefer SetValues for heterogeneous grids.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Range('B2:B10').Value := 0;
end;

Formula

Visibility: public
Declaration

Delphi
property Formula: string;
C++
__property System::UnicodeString Formula;

Where used: Broadcast one formula string to every cell (usually wrong for relative refs — prefer SetFormulas with per-cell formulas).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  { Better: SetFormulas with distinct formulas per row }
  S.Range('C2:C2').Formula := '=B2*2';
end;

NumberFormat

Visibility: public
Declaration

Delphi
property NumberFormat: string;
C++
__property System::UnicodeString NumberFormat;

Where used: Apply one number format to the whole range.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Range('B2:B20').NumberFormat := '0.00';
end;

FontName / FontSize / FontBold / FontItalic / FontUnderline / FontColor

Visibility: public
Declaration

Delphi
{ same property types as `TSheetCellRef` (applied to each cell). }
C++
/* same property types as `TSheetCellRef` (applied to each cell). */

Where used: Bulk typography for headers and tables. FontSize is points.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Range('A1:C1').FontBold := True;
  S.Range('A1:C1').FontName := 'Calibri';
  S.Range('A1:C1').FontSize := 11;
  S.Range('A1:C1').FontColor := TColor($FFFFFF);
end;

FillColor

Visibility: public
Declaration

Delphi
property FillColor: TColor;
C++
__property System::Uitypes::TColor FillColor;

Where used: Bulk solid fill (header bands, zebra via loops).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Range('A1:C1').FillColor := TColor($4472C4);
end;

HorizontalAlignment / VerticalAlignment / WrapText

Visibility: public
Declaration

Delphi
{ same as cell refs, applied per cell in the range. }
C++
/* same as cell refs, applied per cell in the range. */

Where used: Align a block (headers centered, body left, wrap long notes).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Range('A1:C1').HorizontalAlignment := haCenter;
  S.Range('A1:C1').VerticalAlignment := vaCenter;
  S.Range('A2:C20').WrapText := False;
end;

SetValues

Visibility: public
Declaration

Delphi
procedure SetValues(const AValues: TArray<TArray<Variant>>);
C++
void __fastcall SetValues(const System::DynamicArray<System::DynamicArray<Variant>> &AValues);

Where used: Paste a 2-D array starting at the range’s top-left (rows × columns). Faster and clearer than cell-by-cell loops for tables.

How to use:

var
  S: TAuthoringSheet;
  Rows: TArray<TArray<Variant>>;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  SetLength(Rows, 2);
  Rows[0] := TArray<Variant>.Create('Name', 'Qty');
  Rows[1] := TArray<Variant>.Create('Widget', 3);
  S.Range('A1:B2').SetValues(Rows);
end;

SetFormulas

Visibility: public
Declaration

Delphi
procedure SetFormulas(const AFormulas: TArray<TArray<string>>);
C++
void __fastcall SetFormulas(const System::DynamicArray<System::DynamicArray<string>> &AFormulas);

Where used: Write a grid of formula strings (include leading =).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Range('C2:C3').SetFormulas([
    TArray<string>.Create('=B2*2'),
    TArray<string>.Create('=B3*2')
  ]);
  MagiXells1.Recalculate;
end;

Clear

Visibility: public
Declaration

Delphi
procedure Clear;
C++
void __fastcall Clear();

Where used: Clear values and formats across the range.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Range('A1:D10').Clear;
end;

ClearContents

Visibility: public
Declaration

Delphi
procedure ClearContents;
C++
void __fastcall ClearContents();

Where used: Clear values/formulas; keep formats.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Range('A1:D10').ClearContents;
end;

ClearFormats

Visibility: public
Declaration

Delphi
procedure ClearFormats;
C++
void __fastcall ClearFormats();

Where used: Strip formats; keep values.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Range('A1:D10').ClearFormats;
end;

ApplyFormat

Visibility: public
Declaration

Delphi
procedure ApplyFormat(const AFormat: TCellFormat);
C++
void __fastcall ApplyFormat(const TCellFormat AFormat);

Where used: Apply one TCellFormat to every cell in the range.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Range('A1:C10').ApplyFormat(MagiXells1.GetActiveCellFormat);
end;

SetBorder

Visibility: public
Declaration

Delphi
procedure SetBorder(ASide: TBorderSideKind; AStyle: TBorderLineStyle; AColor: TColor = SheetClDefault);
C++
void __fastcall SetBorder(
  TBorderSideKind ASide,
  TBorderLineStyle AStyle,
  System::Uitypes::TColor AColor = SheetClDefault
);

Where used: Outer edge of the range on one side (each outer cell gets that side).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Range('A1:D10').SetBorder(bsTop, blsMedium);
end;

BorderAround

Visibility: public
Declaration

Delphi
procedure BorderAround(AStyle: TBorderLineStyle; AColor: TColor = SheetClDefault);
C++
void __fastcall BorderAround(
  TBorderLineStyle AStyle,
  System::Uitypes::TColor AColor = SheetClDefault
);

Where used: Outline the whole range.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Range('A1:D10').BorderAround(blsThin);
end;

BorderInside

Visibility: public
Declaration

Delphi
procedure BorderInside(AStyle: TBorderLineStyle; AColor: TColor = SheetClDefault);
C++
void __fastcall BorderInside(
  TBorderLineStyle AStyle,
  System::Uitypes::TColor AColor = SheetClDefault
);

Where used: Internal grid lines (not the outer box). Combine with BorderAround for a full table look.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Range('A1:D10').BorderAround(blsThin);
  S.Range('A1:D10').BorderInside(blsHair);
end;

FontColorTheme / FillThemeColor

Visibility: public
Declaration

Delphi
procedure FontColorTheme(AThemeIndex: Integer; ATint: Double = 0);
procedure FillThemeColor(AThemeIndex: Integer; ATint: Double = 0);
C++
void __fastcall FontColorTheme(int AThemeIndex, double ATint = 0);
void __fastcall FillThemeColor(int AThemeIndex, double ATint = 0);

Where used: Theme colors across a block.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Range('A1:A10').FillThemeColor(5, 0);
end;

Merge

Visibility: public
Declaration

Delphi
procedure Merge;
C++
void __fastcall Merge();

Where used: Merge the range into one cell (title banners). Value typically lives in the top-left.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].Text := 'Report title';
  S.Range('A1:D1').Merge;
  S.Range('A1:D1').HorizontalAlignment := haCenter;
end;

Unmerge

Visibility: public
Declaration

Delphi
procedure Unmerge;
C++
void __fastcall Unmerge();

Where used: Undo a merge covering this range.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Range('A1:D1').Unmerge;
end;

TAuthoringSheet

Workbook-aware façade: Cell / Range plus charts, tables, pivots, sort, validation, structure, and view options.
Delphi: MagiXells1.Workbook.UseActiveSheet.
C++Builder: TAuthoringSheet::Create(Workbook, ActiveSheet) — see C++Builder.

Create

Visibility: public
Declaration

Delphi
class function Create(AWorkbook: TWorkbook; ASheet: TWorksheet): TAuthoringSheet; static;
C++
static TAuthoringSheet __fastcall Create(TWorkbook* AWorkbook, TWorksheet* ASheet);

Where used: Bind any workbook/sheet pair (required in C++; also when helpers are unavailable).

How to use:

var
  S: TAuthoringSheet;
begin
  S := TAuthoringSheet.Create(MagiXells1.Workbook, MagiXells1.ActiveSheet);
  S.Cell['A1'].Text := 'Bound explicitly';
end;

Workbook

Visibility: public
Declaration

Delphi
property Workbook: TWorkbook;
C++
__property TWorkbook* Workbook;

Where used: Reach named formulas, styles, or sheet list from an authoring sheet.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  Assert(S.Workbook = MagiXells1.Workbook);
end;

Sheet

Visibility: public
Declaration

Delphi
property Sheet: TWorksheet;
C++
__property TWorksheet* Sheet;

Where used: Pass the underlying worksheet to APIs that take TWorksheet (low-level helpers, Create factories).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  Assert(S.Sheet = MagiXells1.ActiveSheet);
end;

Cell

Visibility: public
Declaration

Delphi
property Cell[const A1: string]: TSheetCellRef;
C++
__property TSheetCellRef Cell[const System::UnicodeString A1];

Where used: Primary A1 cell accessor.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].Text := 'Hi';
end;

Range

Visibility: public
Declaration

Delphi
function Range(const A1: string): TSheetRangeRef;
C++
TSheetRangeRef __fastcall Range(const System::UnicodeString A1);

Where used: Primary A1 range accessor.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Range('A1:B2').FontBold := True;
end;

AddChart (series array)

Visibility: public
Declaration

Delphi
function AddChart(const ATitle: string; AChartType: TSheetChartType;
  const ASeries: TArray<TSheetChartSeries>; const AAnchorA1: string;
  AWidthCols: Integer = 8; AHeightRows: Integer = 12): TSheetDrawing; overload;
C++
TSheetDrawing* __fastcall AddChart(
  const System::UnicodeString ATitle, TSheetChartType AChartType,
  const System::DynamicArray<TSheetChartSeries> &ASeries,
  const System::UnicodeString AAnchorA1,
  int AWidthCols = 8, int AHeightRows = 12) /* overload */;

Where used: Multi-series charts. AAnchorA1 is the top-left anchor cell; width/height are in column/row spans, not pixels. Chart types include sctColumn, sctLine, sctPie, …

How to use:

var
  S: TAuthoringSheet;
  Series: TArray<TSheetChartSeries>;
  Ser: TSheetChartSeries;
  D: TSheetDrawing;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  Ser := Default(TSheetChartSeries);
  Ser.Title := 'Qty';
  Ser.ValuesFormula := 'Sheet1!$B$2:$B$5';
  Ser.CategoriesFormula := 'Sheet1!$A$2:$A$5';
  Ser.PlotKind := sctColumn;
  Series := [Ser];
  D := S.AddChart('Sales', sctColumn, Series, 'E2', 8, 12);
end;

AddChart (formulas)

Visibility: public
Declaration

Delphi
function AddChart(const ATitle: string; AChartType: TSheetChartType;
  const AValuesFormula, ACategoriesFormula, AAnchorA1: string;
  AWidthCols: Integer = 8; AHeightRows: Integer = 12): TSheetDrawing; overload;
C++
TSheetDrawing* __fastcall AddChart(
  const System::UnicodeString ATitle, TSheetChartType AChartType,
  const System::UnicodeString AValuesFormula,
  const System::UnicodeString ACategoriesFormula,
  const System::UnicodeString AAnchorA1,
  int AWidthCols = 8, int AHeightRows = 12) /* overload */;

Where used: Single-series chart from values/categories formulas (sheet-qualified A1 recommended).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.AddChart('Sales', sctColumn,
    'Sheet1!$B$2:$B$5', 'Sheet1!$A$2:$A$5', 'D2');
end;

AddPictureFromFile

Visibility: public
Declaration

Delphi
function AddPictureFromFile(const AFilePath, AAnchorA1: string; AWidthPx: Integer = 240; AHeightPx: Integer = 180): TSheetDrawing;
C++
TSheetDrawing* __fastcall AddPictureFromFile(
  const System::UnicodeString AFilePath,
  const System::UnicodeString AAnchorA1,
  int AWidthPx = 240,
  int AHeightPx = 180
);

Where used: Embed an image from disk. Size is pixels (unlike chart col/row spans).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.AddPictureFromFile('C:\Assets\logo.png', 'G2', 240, 180);
end;

AddPictureFromBytes

Visibility: public
Declaration

Delphi
function AddPictureFromBytes(const ABytes: TBytes; const AContentType, AAnchorA1: string; AWidthPx: Integer = 240; AHeightPx: Integer = 180): TSheetDrawing;
C++
TSheetDrawing* __fastcall AddPictureFromBytes(
  const System::DynamicArray<System::Byte> ABytes,
  const System::UnicodeString AContentType,
  const System::UnicodeString AAnchorA1,
  int AWidthPx = 240,
  int AHeightPx = 180
);

Where used: Embed image bytes (image/png, image/jpeg, …) without a temp file.

How to use:

var
  S: TAuthoringSheet;
  Bytes: TBytes;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  Bytes := TFile.ReadAllBytes('C:\Assets\logo.png');
  S.AddPictureFromBytes(Bytes, 'image/png', 'G2', 240, 180);
end;

AddShape

Visibility: public
Declaration

Delphi
function AddShape(const APresetGeom, AAnchorA1: string; AWidthPx: Integer = 120; AHeightPx: Integer = 80; AFill: TColor = SheetClDefault; ALine: TColor = SheetClDefault): TSheetDrawing;
C++
TSheetDrawing* __fastcall AddShape(
  const System::UnicodeString APresetGeom,
  const System::UnicodeString AAnchorA1,
  int AWidthPx = 120,
  int AHeightPx = 80,
  System::Uitypes::TColor AFill = SheetClDefault,
  System::Uitypes::TColor ALine = SheetClDefault
);

Where used: Simple preset shapes (e.g. 'rect'). Size in pixels.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.AddShape('rect', 'I2', 120, 80, TColor($4472C4), TColor($000000));
end;

AddInkFromInkML

Visibility: public
Declaration

Delphi
function AddInkFromInkML(const ABytes: TBytes; const AAnchorA1: string; AWidthPx: Integer = 240; AHeightPx: Integer = 180): TSheetDrawing;
C++
TSheetDrawing* __fastcall AddInkFromInkML(
  const System::DynamicArray<System::Byte> ABytes,
  const System::UnicodeString AAnchorA1,
  int AWidthPx = 240,
  int AHeightPx = 180
);

Where used: Place InkML stroke data as a drawing.

How to use:

var
  S: TAuthoringSheet;
  InkBytes: TBytes;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  InkBytes := TFile.ReadAllBytes('C:\Data\stroke.inkml');
  S.AddInkFromInkML(InkBytes, 'A20', 240, 180);
end;

ChartCount

Visibility: public
Declaration

Delphi
function ChartCount: Integer;
C++
int __fastcall ChartCount();

Where used: How many chart drawings are on this sheet (for enumeration).

How to use:

var
  S: TAuthoringSheet;
  I: Integer;
  D: TSheetDrawing;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  for I := 0 to S.ChartCount - 1 do  { 0-based }
    D := S.GetChart(I);
end;

GetChart

Visibility: public
Declaration

Delphi
function GetChart(AIndex: Integer): TSheetDrawing;
C++
TSheetDrawing* __fastcall GetChart(int AIndex);

Where used: Access a chart by 0-based index among chart drawings only.

How to use:

var
  S: TAuthoringSheet;
  D: TSheetDrawing;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  if S.ChartCount > 0 then
    D := S.GetChart(0);
end;

DeleteChart

Visibility: public
Declaration

Delphi
procedure DeleteChart(AIndex: Integer);
C++
void __fastcall DeleteChart(int AIndex);

Where used: Remove a chart by 0-based chart index.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  if S.ChartCount > 0 then
    S.DeleteChart(0);
end;

PictureCount

Visibility: public
Declaration

Delphi
function PictureCount: Integer;
C++
int __fastcall PictureCount();

Where used: Count picture drawings on the sheet.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  Caption := Format('Pictures: %d', [S.PictureCount]);
end;

GetPicture

Visibility: public
Declaration

Delphi
function GetPicture(AIndex: Integer): TSheetDrawing;
C++
TSheetDrawing* __fastcall GetPicture(int AIndex);

Where used: Access a picture by 0-based index among pictures.

How to use:

var
  S: TAuthoringSheet;
  D: TSheetDrawing;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  if S.PictureCount > 0 then
    D := S.GetPicture(0);
end;

DeletePicture

Visibility: public
Declaration

Delphi
procedure DeletePicture(AIndex: Integer);
C++
void __fastcall DeletePicture(int AIndex);

Where used: Remove a picture by 0-based index.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  if S.PictureCount > 0 then
    S.DeletePicture(0);
end;

AddTable

Visibility: public
Declaration

Delphi
function AddTable(const AName, ARangeA1: string; AHasHeader: Boolean = True; AShowFilter: Boolean = True): TSheetTable;
C++
TSheetTable* __fastcall AddTable(
  const System::UnicodeString AName,
  const System::UnicodeString ARangeA1,
  bool AHasHeader = true,
  bool AShowFilter = true
);

Where used: Create an Excel-like Table (+ optional AutoFilter) over an existing block.

How to use:

var
  S: TAuthoringSheet;
  T: TSheetTable;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  T := S.AddTable('T1', 'A1:C10', True, True);
end;

MaterializeSpillAsTable

Visibility: public
Declaration

Delphi
function MaterializeSpillAsTable(const AAnchorA1: string; const ATableName: string = ''; AHasHeader: Boolean = True): TSheetTable;
C++
TSheetTable* __fastcall MaterializeSpillAsTable(
  const System::UnicodeString AAnchorA1,
  const System::UnicodeString ATableName = L"",
  bool AHasHeader = true
);

Where used: After a live spill (e.g. IMPORTHTML) at the anchor: clear the spill/formula, write values as plain cells, and create a Table + AutoFilter.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  { After a live IMPORTHTML spill at A1 (Google-compatible 3-arg formula): }
  S.MaterializeSpillAsTable('A1', 'SP500', True);
end;

DeleteTable

Visibility: public
Declaration

Delphi
procedure DeleteTable(const AName: string);
C++
void __fastcall DeleteTable(const System::UnicodeString AName);

Where used: Remove a table by name (values remain unless you clear separately).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.DeleteTable('T1');
end;

AddPivotTable

Visibility: public
Declaration

Delphi
function AddPivotTable(const AName, ASourceRangeA1, ADestA1: string): TPivotTable;
C++
TPivotTable* __fastcall AddPivotTable(
  const System::UnicodeString AName,
  const System::UnicodeString ASourceRangeA1,
  const System::UnicodeString ADestA1
);

Where used: Create a worksheet-sourced pivot. Then add fields via TPivotFieldRef (0-based cache field index) and call RefreshPivotTable. See PivotTables.

How to use:

var
  S: TAuthoringSheet;
  P: TPivotTable;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  P := S.AddPivotTable('SalesPT', 'A1:C20', 'E1');
  P.AddField(TPivotFieldRef.Create(0, pfrRow));
  P.AddField(TPivotFieldRef.Create(2, pfrValue, paSum));
  S.RefreshPivotTable('SalesPT');
end;

AddPivotTableMulti

Visibility: public
Declaration

Delphi
function AddPivotTableMulti(const AName: string; const ARanges: TArray<string>; const ADestA1: string): TPivotTable;
C++
TPivotTable* __fastcall AddPivotTableMulti(
  const System::UnicodeString AName,
  const System::DynamicArray<string> &ARanges,
  const System::UnicodeString ADestA1
);

Where used: Multi-consolidation pivot cache from several A1 ranges on this sheet’s context.

How to use:

var
  S: TAuthoringSheet;
  P: TPivotTable;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  P := S.AddPivotTableMulti('MultiPT',
    TArray<string>.Create('A1:C10', 'E1:G10'), 'I1');
end;

AddPivotTableOlap

Visibility: public
Declaration

Delphi
function AddPivotTableOlap(const AName, AConnectionId, ADestA1: string): TPivotTable;
C++
TPivotTable* __fastcall AddPivotTableOlap(
  const System::UnicodeString AName,
  const System::UnicodeString AConnectionId,
  const System::UnicodeString ADestA1
);

Where used: OLAP-backed pivot; connection must exist (AddOlapConnection). See PivotTables.

How to use:

var
  S: TAuthoringSheet;
  Conn: TOlapConnection;
  P: TPivotTable;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  Conn := S.AddOlapConnection('OLAP1');
  P := S.AddPivotTableOlap('OlapPT', Conn.Id, 'E1');
end;

RefreshPivotTable

Visibility: public
Declaration

Delphi
procedure RefreshPivotTable(const AName: string);
C++
void __fastcall RefreshPivotTable(const System::UnicodeString AName);

Where used: Rebuild pivot output after source edits or field changes.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.RefreshPivotTable('SalesPT');
end;

DeletePivotTable

Visibility: public
Declaration

Delphi
procedure DeletePivotTable(const AName: string);
C++
void __fastcall DeletePivotTable(const System::UnicodeString AName);

Where used: Remove a pivot by name.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.DeletePivotTable('SalesPT');
end;

AddSlicer

Visibility: public
Declaration

Delphi
function AddSlicer(const AName, APivotName, AFieldName, AAnchorA1: string): TSheetSlicer;
C++
TSheetSlicer* __fastcall AddSlicer(
  const System::UnicodeString AName,
  const System::UnicodeString APivotName,
  const System::UnicodeString AFieldName,
  const System::UnicodeString AAnchorA1
);

Where used: Visual filter for a pivot field. See PivotTables.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.AddSlicer('RegionSlicer', 'SalesPT', 'Region', 'A25');
end;

AddTimeline

Visibility: public
Declaration

Delphi
function AddTimeline(const AName, APivotName, AFieldName, AAnchorA1: string): TSheetSlicer;
C++
TSheetSlicer* __fastcall AddTimeline(
  const System::UnicodeString AName,
  const System::UnicodeString APivotName,
  const System::UnicodeString AFieldName,
  const System::UnicodeString AAnchorA1
);

Where used: Date-oriented slicer/timeline for a pivot field.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.AddTimeline('OrderTimeline', 'SalesPT', 'OrderDate', 'A30');
end;

SetSlicerSelection

Visibility: public
Declaration

Delphi
procedure SetSlicerSelection(const ASlicerName: string; const AItems: TArray<string>);
C++
void __fastcall SetSlicerSelection(
  const System::UnicodeString ASlicerName,
  const System::DynamicArray<string> &AItems
);

Where used: Programmatically select slicer items.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.SetSlicerSelection('RegionSlicer', TArray<string>.Create('West', 'East'));
end;

ToggleSlicerItem

Visibility: public
Declaration

Delphi
procedure ToggleSlicerItem(const ASlicerName, AItem: string);
C++
void __fastcall ToggleSlicerItem(
  const System::UnicodeString ASlicerName,
  const System::UnicodeString AItem
);

Where used: Toggle one slicer item’s selection.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.ToggleSlicerItem('RegionSlicer', 'West');
end;

ClearSlicerSelection

Visibility: public
Declaration

Delphi
procedure ClearSlicerSelection(const ASlicerName: string);
C++
void __fastcall ClearSlicerSelection(const System::UnicodeString ASlicerName);

Where used: Clear slicer filters.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.ClearSlicerSelection('RegionSlicer');
end;

AddPivotChart

Visibility: public
Declaration

Delphi
function AddPivotChart(const APivotName, AAnchorA1: string; AWidthCols: Integer = 8; AHeightRows: Integer = 12): TSheetDrawing;
C++
TSheetDrawing* __fastcall AddPivotChart(
  const System::UnicodeString APivotName,
  const System::UnicodeString AAnchorA1,
  int AWidthCols = 8,
  int AHeightRows = 12
);

Where used: Chart bound to an existing pivot; size in column/row spans.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.AddPivotChart('SalesPT', 'H1', 8, 12);
end;

SetPivotFieldShowAs

Visibility: public
Declaration

Delphi
procedure SetPivotFieldShowAs(const APivotName: string; AValueFieldIndex: Integer; AShowAs: TPivotShowAs);
C++
void __fastcall SetPivotFieldShowAs(
  const System::UnicodeString APivotName,
  int AValueFieldIndex,
  TPivotShowAs* AShowAs
);

Where used: Show-as options on a value field (0-based value-field index).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.SetPivotFieldShowAs('SalesPT', 0, psaPercentOfGrand);
  S.RefreshPivotTable('SalesPT');
end;

AddPivotCalculatedField

Visibility: public
Declaration

Delphi
procedure AddPivotCalculatedField(const APivotName, AFieldName, AFormula: string);
C++
void __fastcall AddPivotCalculatedField(
  const System::UnicodeString APivotName,
  const System::UnicodeString AFieldName,
  const System::UnicodeString AFormula
);

Where used: Add a calculated field to a pivot.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.AddPivotCalculatedField('SalesPT', 'Tax', '=Amount*0.2');
  S.RefreshPivotTable('SalesPT');
end;

AddOlapConnection

Visibility: public
Declaration

Delphi
function AddOlapConnection(const AId: string): TOlapConnection;
C++
TOlapConnection* __fastcall AddOlapConnection(const System::UnicodeString AId);

Where used: Register an OLAP connection id before AddPivotTableOlap.

How to use:

var
  S: TAuthoringSheet;
  Conn: TOlapConnection;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  Conn := S.AddOlapConnection('OLAP1');
end;

EnableAutoFilter

Visibility: public
Declaration

Delphi
procedure EnableAutoFilter(const ARangeA1: string);
C++
void __fastcall EnableAutoFilter(const System::UnicodeString ARangeA1);

Where used: Turn on AutoFilter for a block (without necessarily creating a Table).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.EnableAutoFilter('A1:C10');
end;

ClearAutoFilter

Visibility: public
Declaration

Delphi
procedure ClearAutoFilter;
C++
void __fastcall ClearAutoFilter();

Where used: Remove the sheet AutoFilter.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.ClearAutoFilter;
end;

Sort (single key)

Visibility: public
Declaration

Delphi
procedure Sort(const ARangeA1: string; AKeyCol: Integer; AAscending: Boolean = True; AHasHeader: Boolean = True); overload;
C++
void __fastcall Sort(
  const System::UnicodeString ARangeA1,
  int AKeyCol,
  bool AAscending = true,
  bool AHasHeader = true
) /* overload */;

Where used: Sort data rows. AKeyCol follows TSheetSortKey.Col rules (1-based absolute or 1-based offset in range). Header row is left in place when AHasHeader is True.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Sort('A1:C10', 1, True, True);  { sort by first column of the range }
end;

Sort (multi key)

Visibility: public
Declaration

Delphi
procedure Sort(const ARangeA1: string; const AKeys: TArray<TSheetSortKey>; AHasHeader: Boolean = True); overload;
C++
void __fastcall Sort(
  const System::UnicodeString ARangeA1,
  const System::DynamicArray<TSheetSortKey> &AKeys,
  bool AHasHeader = true
) /* overload */;

Where used: Multi-column sorts.

How to use:

var
  S: TAuthoringSheet;
  Keys: TArray<TSheetSortKey>;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  SetLength(Keys, 1);
  Keys[0].Col := 1;
  Keys[0].Ascending := True;
  S.Sort('A1:C10', Keys, True);
end;

AddConditionalFormat

Visibility: public
Declaration

Delphi
procedure AddConditionalFormat(const ARangeA1: string; AOp: TCfOperator; const AFormula1: string; const AFormula2: string = ''; AFill: TColor = SheetClDefault; AFont: TColor = SheetClDefault; ABold: Boolean = False);
C++
void __fastcall AddConditionalFormat(
  const System::UnicodeString ARangeA1,
  TCfOperator* AOp,
  const System::UnicodeString AFormula1,
  const System::UnicodeString AFormula2 = L"",
  System::Uitypes::TColor AFill = SheetClDefault,
  System::Uitypes::TColor AFont = SheetClDefault,
  bool ABold = false
);

Where used: Highlight cells by operator (cfoGreaterThan, cfoBetween, …).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.AddConditionalFormat('B2:B20', cfoGreaterThan, '100', '', TColor($C6EFCE));
end;

ClearConditionalFormats

Visibility: public
Declaration

Delphi
procedure ClearConditionalFormats(const ARangeA1: string = '');
C++
void __fastcall ClearConditionalFormats(const System::UnicodeString ARangeA1 = L"");

Where used: Clear CF rules intersecting the range; empty string clears sheet rules per implementation defaults.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.ClearConditionalFormats('B2:B20');
end;

AddListValidation

Visibility: public
Declaration

Delphi
procedure AddListValidation(const ARangeA1, AListOrFormula: string; const APrompt: string = ''; const AError: string = '');
C++
void __fastcall AddListValidation(
  const System::UnicodeString ARangeA1,
  const System::UnicodeString AListOrFormula,
  const System::UnicodeString APrompt = L"",
  const System::UnicodeString AError = L""
);

Where used: Dropdown lists ('"Yes,No"' or a range formula).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.AddListValidation('D2:D20', '"Yes,No"', 'Pick one', 'Invalid');
end;

AddWholeValidation

Visibility: public
Declaration

Delphi
procedure AddWholeValidation(const ARangeA1: string; AOp: TDataValidationOperator; const AFormula1: string; const AFormula2: string = '');
C++
void __fastcall AddWholeValidation(
  const System::UnicodeString ARangeA1,
  TDataValidationOperator* AOp,
  const System::UnicodeString AFormula1,
  const System::UnicodeString AFormula2 = L""
);

Where used: Whole-number validation (dvoBetween, …).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.AddWholeValidation('E2:E20', dvoBetween, '1', '10');
end;

ClearValidations

Visibility: public
Declaration

Delphi
procedure ClearValidations(const ARangeA1: string = '');
C++
void __fastcall ClearValidations(const System::UnicodeString ARangeA1 = L"");

Where used: Remove data-validation rules for a range (or broader clear when empty).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.ClearValidations('D2:E20');
end;

Visibility: public
Declaration

Delphi
procedure SetHyperlink(const ACellA1, ATarget: string);
C++
void __fastcall SetHyperlink(
  const System::UnicodeString ACellA1,
  const System::UnicodeString ATarget
);

Where used: Attach a URL or location target to a cell.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.SetHyperlink('A1', 'https://example.com');
end;

Visibility: public
Declaration

Delphi
procedure ClearHyperlink(const ACellA1: string);
C++
void __fastcall ClearHyperlink(const System::UnicodeString ACellA1);

Where used: Remove a cell hyperlink.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.ClearHyperlink('A1');
end;

Visibility: public
Declaration

Delphi
function TryGetHyperlink(const ACellA1: string; out ATarget: string): Boolean;
C++
bool __fastcall TryGetHyperlink(
  const System::UnicodeString ACellA1,
  System::UnicodeString& ATarget
);

Where used: Read back a hyperlink target if present.

How to use:

var
  S: TAuthoringSheet;
  Target: string;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  if S.TryGetHyperlink('A1', Target) then
    ShowMessage(Target);
end;

SetComment

Visibility: public
Declaration

Delphi
procedure SetComment(const ACellA1, AText: string; const AAuthor: string = '');
C++
void __fastcall SetComment(
  const System::UnicodeString ACellA1,
  const System::UnicodeString AText,
  const System::UnicodeString AAuthor = L""
);

Where used: Cell note/comment.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.SetComment('A1', 'Note', 'Author');
end;

ClearComment

Visibility: public
Declaration

Delphi
procedure ClearComment(const ACellA1: string);
C++
void __fastcall ClearComment(const System::UnicodeString ACellA1);

Where used: Remove a comment.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.ClearComment('A1');
end;

Freeze

Visibility: public
Declaration

Delphi
procedure Freeze(ARows, ACols: Integer);
C++
void __fastcall Freeze(int ARows, int ACols);

Where used: Freeze the first N rows and/or columns (0 = none). These are counts, not A1 indexes.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Freeze(1, 1);  { freeze row 1 and column A }
end;

SetZoom

Visibility: public
Declaration

Delphi
procedure SetZoom(APercent: Integer);
C++
void __fastcall SetZoom(int APercent);

Where used: Sheet zoom percent (clamped roughly 10..400).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.SetZoom(120);
end;

SetRtl

Visibility: public
Declaration

Delphi
procedure SetRtl(AValue: Boolean);
C++
void __fastcall SetRtl(bool AValue);

Where used: Sheet right-to-left layout.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.SetRtl(True);
end;

SetVisibility

Visibility: public
Declaration

Delphi
procedure SetVisibility(AValue: TSheetVisibility);
C++
void __fastcall SetVisibility(TSheetVisibility AValue);

Where used: svVisible / svHidden / svVeryHidden for this sheet. See types.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseSheet('Scratch');
  S.SetVisibility(svHidden);
end;

Hide

Visibility: public
Declaration

Delphi
procedure Hide(AVeryHidden: Boolean = False);
C++
void __fastcall Hide(bool AVeryHidden = false);

Where used: Convenience for svHidden or svVeryHidden.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseSheet('Scratch');
  S.Hide;             { svHidden }
  S.Hide(True);       { svVeryHidden }
end;

Unhide

Visibility: public
Declaration

Delphi
procedure Unhide;
C++
void __fastcall Unhide();

Where used: Show the sheet again (svVisible).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseSheet('Scratch');
  S.Unhide;
end;

Visibility

Visibility: public
Declaration

Delphi
function Visibility: TSheetVisibility;
C++
TSheetVisibility __fastcall Visibility();

Where used: Read current visibility.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  if S.Visibility = svVeryHidden then
    S.Unhide;
end;

IsVisible

Visibility: public
Declaration

Delphi
function IsVisible: Boolean;
C++
bool __fastcall IsVisible();

Where used: Quick check for svVisible.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseSheet('Scratch');
  if not S.IsVisible then
    S.Unhide;
end;

SetPrintArea

Visibility: public
Declaration

Delphi
procedure SetPrintArea(const ARangeA1: string);
C++
void __fastcall SetPrintArea(const System::UnicodeString ARangeA1);

Where used: Restrict print/export area.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.SetPrintArea('A1:G40');
end;

ClearPrintArea

Visibility: public
Declaration

Delphi
procedure ClearPrintArea;
C++
void __fastcall ClearPrintArea();

Where used: Clear a previously set print area.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.ClearPrintArea;
end;

InsertRows

Visibility: public
Declaration

Delphi
procedure InsertRows(AStartRow, ACount: Integer);
C++
void __fastcall InsertRows(int AStartRow, int ACount);

Where used: Insert rows before 1-based AStartRow (same coordinate system as TCellAddress.Row).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.InsertRows(5, 2);  { insert 2 rows before row 5 }
end;

DeleteRows

Visibility: public
Declaration

Delphi
procedure DeleteRows(AStartRow, ACount: Integer);
C++
void __fastcall DeleteRows(int AStartRow, int ACount);

Where used: Delete starting at 1-based row.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.DeleteRows(5, 2);
end;

InsertColumns

Visibility: public
Declaration

Delphi
procedure InsertColumns(AStartCol, ACount: Integer);
C++
void __fastcall InsertColumns(int AStartCol, int ACount);

Where used: Insert columns before 1-based AStartCol (1 = A).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.InsertColumns(3, 1);  { insert before column C }
end;

DeleteColumns

Visibility: public
Declaration

Delphi
procedure DeleteColumns(AStartCol, ACount: Integer);
C++
void __fastcall DeleteColumns(int AStartCol, int ACount);

Where used: Delete starting at 1-based column.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.DeleteColumns(3, 1);
end;

HideRows

Visibility: public
Declaration

Delphi
procedure HideRows(AStartRow, AEndRow: Integer; AHidden: Boolean = True);
C++
void __fastcall HideRows(int AStartRow, int AEndRow, bool AHidden = true);

Where used: Hide/unhide an inclusive 1-based row span.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.HideRows(10, 12, True);
end;

HideColumns

Visibility: public
Declaration

Delphi
procedure HideColumns(AStartCol, AEndCol: Integer; AHidden: Boolean = True);
C++
void __fastcall HideColumns(int AStartCol, int AEndCol, bool AHidden = true);

Where used: Hide/unhide inclusive 1-based columns (5,5 = column E).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.HideColumns(5, 5, True);
end;

SetRowOutlineLevel

Visibility: public
Declaration

Delphi
procedure SetRowOutlineLevel(AStartRow, AEndRow, ALevel: Integer);
C++
void __fastcall SetRowOutlineLevel(int AStartRow, int AEndRow, int ALevel);

Where used: Group/outline rows (1-based inclusive span).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.SetRowOutlineLevel(2, 10, 1);
end;

SetColOutlineLevel

Visibility: public
Declaration

Delphi
procedure SetColOutlineLevel(AStartCol, AEndCol, ALevel: Integer);
C++
void __fastcall SetColOutlineLevel(int AStartCol, int AEndCol, int ALevel);

Where used: Group/outline columns (1-based).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.SetColOutlineLevel(2, 4, 1);
end;

SetColWidthChars

Visibility: public
Declaration

Delphi
procedure SetColWidthChars(AStartCol, AEndCol: Integer; AWidth: Double);
C++
void __fastcall SetColWidthChars(int AStartCol, int AEndCol, double AWidth);

Where used: Set Excel character-unit widths for an inclusive column span. Indexes are 1-based (1 = A, 3 = C) — same as TCellAddress.Col / AutoFitColumn, not the control’s 0-based SelectRange. See measurement units.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.SetColWidthChars(1, 3, 14);  { columns A..C }
end;

SetRowHeightPt

Visibility: public
Declaration

Delphi
procedure SetRowHeightPt(AStartRow, AEndRow: Integer; AHeight: Double);
C++
void __fastcall SetRowHeightPt(int AStartRow, int AEndRow, double AHeight);

Where used: Set row heights in points for a 1-based inclusive span.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.SetRowHeightPt(1, 1, 20);  { row 1 = 20 pt }
end;

GetColWidthChars

Visibility: public
Declaration

Delphi
function GetColWidthChars(ACol: Integer): Double;
C++
double __fastcall GetColWidthChars(int ACol);

Where used: Read character width for 1-based column.

How to use:

var
  S: TAuthoringSheet;
  W: Double;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  W := S.GetColWidthChars(1);  { column A }
end;

GetRowHeightPt

Visibility: public
Declaration

Delphi
function GetRowHeightPt(ARow: Integer): Double;
C++
double __fastcall GetRowHeightPt(int ARow);

Where used: Read row height in points (1-based row).

How to use:

var
  S: TAuthoringSheet;
  H: Double;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  H := S.GetRowHeightPt(1);
end;

AutoFitColumn

Visibility: public
Declaration

Delphi
procedure AutoFitColumn(ACol: Integer);
C++
void __fastcall AutoFitColumn(int ACol);

Where used: Fit one column to content. 1-based (1 = A); values < 1 are ignored.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.AutoFitColumn(1);
end;

AutoFitColumns

Visibility: public
Declaration

Delphi
procedure AutoFitColumns(AStartCol, AEndCol: Integer);
C++
void __fastcall AutoFitColumns(int AStartCol, int AEndCol);

Where used: Auto-fit an inclusive 1-based column span.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.AutoFitColumns(1, 4);  { A..D }
end;

AutoFitRow

Visibility: public
Declaration

Delphi
procedure AutoFitRow(ARow: Integer);
C++
void __fastcall AutoFitRow(int ARow);

Where used: Fit one row to wrapped content (1-based).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.AutoFitRow(1);
end;

AutoFitRows

Visibility: public
Declaration

Delphi
procedure AutoFitRows(AStartRow, AEndRow: Integer);
C++
void __fastcall AutoFitRows(int AStartRow, int AEndRow);

Where used: Auto-fit an inclusive 1-based row span.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.AutoFitRows(1, 20);
end;

TWorkbookNamesFacade

Named formula helpers (Workbook.Names in Delphi). C++Builder: TWorkbookNamesFacade::Create(Workbook).

Create

Visibility: public
Declaration

Delphi
class function Create(AWorkbook: TWorkbook): TWorkbookNamesFacade; static;
C++
static TWorkbookNamesFacade __fastcall Create(TWorkbook* AWorkbook);

Where used: Explicit façade construction (C++Builder).

How to use:

var
  N: TWorkbookNamesFacade;
begin
  N := TWorkbookNamesFacade.Create(MagiXells1.Workbook);
  N.Define('Tax', '0.2');
end;

Define

Visibility: public
Declaration

Delphi
procedure Define(const AName, AFormula: string);
C++
void __fastcall Define(
  const System::UnicodeString AName,
  const System::UnicodeString AFormula
);

Where used: Define or replace a named formula (constant or reference).

How to use:

begin
  MagiXells1.Workbook.Names.Define('Tax', '0.2');
  MagiXells1.Workbook.Names.Define('TitleCell', 'Sheet1!$A$1');
end;

Delete

Visibility: public
Declaration

Delphi
procedure Delete(const AName: string);
C++
void __fastcall Delete(const System::UnicodeString AName);

Where used: Remove a named formula.

How to use:

begin
  MagiXells1.Workbook.Names.Delete('Tax');
end;

TryGet

Visibility: public
Declaration

Delphi
function TryGet(const AName: string; out AFormula: string): Boolean;
C++
bool __fastcall TryGet(
  const System::UnicodeString AName,
  System::UnicodeString& AFormula
);

Where used: Look up a name without raising.

How to use:

var
  F: string;
begin
  if MagiXells1.Workbook.Names.TryGet('Tax', F) then
    ShowMessage(F);
end;

TWorkbookStylesFacade

Style-sheet index helpers (Workbook.Styles).

Create

Visibility: public
Declaration

Delphi
class function Create(AWorkbook: TWorkbook): TWorkbookStylesFacade; static;
C++
static TWorkbookStylesFacade __fastcall Create(TWorkbook* AWorkbook);

Where used: Explicit construction (C++Builder).

How to use:

var
  Styles: TWorkbookStylesFacade;
begin
  Styles := TWorkbookStylesFacade.Create(MagiXells1.Workbook);
end;

Add

Visibility: public
Declaration

Delphi
function Add(const AFormat: TCellFormat): Integer;
C++
int __fastcall Add(const TCellFormat AFormat);

Where used: Register a format; returns a style index for Cell.StyleIndex.

How to use:

var
  Idx: Integer;
begin
  Idx := MagiXells1.Workbook.Styles.Add(MagiXells1.GetActiveCellFormat);
  MagiXells1.Workbook.UseActiveSheet.Cell['A1'].StyleIndex := Idx;
end;

Resolve

Visibility: public
Declaration

Delphi
function Resolve(AStyleIndex: Integer): TCellFormat;
C++
TCellFormat __fastcall Resolve(int AStyleIndex);

Where used: Read back a stored style by index.

How to use:

var
  Fmt: TCellFormat;
begin
  Fmt := MagiXells1.Workbook.Styles.Resolve(0);
end;

TWorksheetSheetAPIHelper

Delphi class helper for TWorksheet. Not available in C++Builder — use TSheetCellRef::Create / TSheetRangeRef::Create instead (C++Builder).

Cell

Visibility: public
Declaration

Delphi
property Cell[const A1: string]: TSheetCellRef;
C++
__property TSheetCellRef Cell[const System::UnicodeString A1];

Where used: Short path when you already have ActiveSheet and only need cell ops (no charts/sort).

How to use:

begin
  MagiXells1.ActiveSheet.Cell['A1'].Text := 'Via helper';
end;

Range

Visibility: public
Declaration

Delphi
function Range(const A1: string): TSheetRangeRef;
C++
TSheetRangeRef __fastcall Range(const System::UnicodeString A1);

Where used: Range ops without TAuthoringSheet.

How to use:

begin
  MagiXells1.ActiveSheet.Range('A1:B2').FontBold := True;
end;

TWorkbookSheetAPIHelper

Delphi class helper for TWorkbook. Not available in C++Builder — use TAuthoringSheet::Create and façade Create methods (C++Builder).

AddWorksheet

Visibility: public
Declaration

Delphi
function AddWorksheet(const AName: string): TWorksheet;
C++
TWorksheet* __fastcall AddWorksheet(const System::UnicodeString AName);

Where used: Append a named sheet.

How to use:

var
  Ws: TWorksheet;
begin
  Ws := MagiXells1.Workbook.AddWorksheet('Extra');
end;

Sheet

Visibility: public
Declaration

Delphi
property Sheet[const AName: string]: TWorksheet;
C++
__property TWorksheet* Sheet[const System::UnicodeString AName];

Where used: Resolve a worksheet by name.

How to use:

var
  Ws: TWorksheet;
begin
  Ws := MagiXells1.Workbook.Sheet['Sales'];
end;

UseSheet (name)

Visibility: public
Declaration

Delphi
function UseSheet(const AName: string): TAuthoringSheet; overload;
C++
TAuthoringSheet __fastcall UseSheet(const System::UnicodeString AName) /* overload */;

Where used: Authoring façade for a named sheet (does not necessarily activate it in the UI).

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseSheet('Sales');
  S.Cell['A1'].Text := 'Sales sheet';
end;

UseSheet (index)

Visibility: public
Declaration

Delphi
function UseSheet(AIndex: Integer): TAuthoringSheet; overload;
C++
TAuthoringSheet __fastcall UseSheet(int AIndex) /* overload */;

Where used: Authoring façade by 0-based sheet index.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseSheet(0);  { first sheet }
end;

UseActiveSheet

Visibility: public
Declaration

Delphi
function UseActiveSheet: TAuthoringSheet;
C++
TAuthoringSheet __fastcall UseActiveSheet();

Where used: Preferred entry point for host apps.

How to use:

var
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  S.Cell['A1'].Text := 'Ready';
end;

Names

Visibility: public
Declaration

Delphi
function Names: TWorkbookNamesFacade;
C++
TWorkbookNamesFacade __fastcall Names();

Where used: Access named formulas.

How to use:

begin
  MagiXells1.Workbook.Names.Define('X', 'Sheet1!$A$1');
end;

Styles

Visibility: public
Declaration

Delphi
function Styles: TWorkbookStylesFacade;
C++
TWorkbookStylesFacade __fastcall Styles();

Where used: Access the style façade.

How to use:

var
  Idx: Integer;
  Fmt: TCellFormat;
begin
  Fmt := MagiXells1.GetActiveCellFormat;
  Idx := MagiXells1.Workbook.Styles.Add(Fmt);
end;

Unit functions

RichRun (flags)

Visibility: public
Declaration

Delphi
function RichRun(const AText: string; Flags: TRichFlags = []; AColor: TColor = SheetClDefault; const AFontName: string = ''; ASize: Single = 0): TRichTextRun; overload;
C++
TRichTextRun __fastcall RichRun(
  const System::UnicodeString AText,
  TRichFlags Flags = [],
  System::Uitypes::TColor AColor = SheetClDefault,
  const System::UnicodeString AFontName = L"",
  float ASize = 0
) /* overload */;

Where used: Build one run for SetRichText.

How to use:

var
  Run: TRichTextRun;
  Runs: TRichTextRuns;
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  Run := RichRun('Hi', [rfBold], TColor($FF0000));
  SetLength(Runs, 1);
  Runs[0] := Run;
  S.Cell['A1'].SetRichText(Runs);
end;

RichRun (font)

Visibility: public
Declaration

Delphi
function RichRun(const AText: string; const AFont: TCellFontInfo): TRichTextRun; overload;
C++
TRichTextRun __fastcall RichRun(
  const System::UnicodeString AText,
  const TCellFontInfo AFont
) /* overload */;

Where used: Build a run from RichFont.

How to use:

var
  Run: TRichTextRun;
begin
  Run := RichRun('Hi', RichFont('Arial', 12, True));
end;

RichFont

Visibility: public
Declaration

Delphi
function RichFont(const AName: string; ASize: Single; ABold: Boolean = False; AItalic: Boolean = False; AColor: TColor = SheetClDefault): TCellFontInfo;
C++
TCellFontInfo __fastcall RichFont(
  const System::UnicodeString AName,
  float ASize,
  bool ABold = false,
  bool AItalic = false,
  System::Uitypes::TColor AColor = SheetClDefault
);

Where used: Construct TCellFontInfo for AddRun / RichRun. ASize is points.

How to use:

var
  Font: TCellFontInfo;
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  Font := RichFont('Arial', 12, True);
  S.Cell['A1'].AddRun('Styled', Font);
end;

HtmlToRichText

Visibility: public
Declaration

Delphi
function HtmlToRichText(const AHtml: string): TRichTextRuns; overload;
function HtmlToRichText(const AHtml: string; const ADefaultFont: TCellFontInfo): TRichTextRuns; overload;
C++
TRichTextRuns* __fastcall HtmlToRichText(const System::UnicodeString AHtml) /* overload */;
TRichTextRuns* __fastcall HtmlToRichText(
  const System::UnicodeString AHtml,
  const TCellFontInfo ADefaultFont
) /* overload */;

Where used: Convert HTML fragments without writing a cell (or before SetRichText).

How to use:

var
  Runs: TRichTextRuns;
  S: TAuthoringSheet;
begin
  S := MagiXells1.Workbook.UseActiveSheet;
  Runs := HtmlToRichText('<b>Bold</b> plain');
  S.Cell['A1'].SetRichText(Runs);
end;

RichTextToHtml

Visibility: public
Declaration

Delphi
function RichTextToHtml(const ARuns: TRichTextRuns): string;
C++
System::UnicodeString __fastcall RichTextToHtml(const TRichTextRuns* ARuns);

Where used: Serialize runs to simple HTML.

How to use:

var
  Html: string;
  Runs: TRichTextRuns;
begin
  Runs := HtmlToRichText('<i>x</i>');
  Html := RichTextToHtml(Runs);
end;

ApplyNumberFormat

Visibility: public
Declaration

Delphi
procedure ApplyNumberFormat(ASheet: TWorksheet; const ACellOrRange, AFormat: string);
C++
void __fastcall ApplyNumberFormat(
  TWorksheet* ASheet,
  const System::UnicodeString ACellOrRange,
  const System::UnicodeString AFormat
);

Where used: One-liner format apply without building a range ref.

How to use:

begin
  ApplyNumberFormat(MagiXells1.ActiveSheet, 'B2:B20', '0.00');
end;

ApplyCellAlignment

Visibility: public
Declaration

Delphi
procedure ApplyCellAlignment(ASheet: TWorksheet; const ACell: string; H: TSheetHAlign; V: TSheetVAlign);
C++
void __fastcall ApplyCellAlignment(
  TWorksheet* ASheet,
  const System::UnicodeString ACell,
  TSheetHAlign H,
  TSheetVAlign V
);

Where used: Set both alignments on one A1 cell.

How to use:

begin
  ApplyCellAlignment(MagiXells1.ActiveSheet, 'A1', haCenter, vaCenter);
end;

SetCellWrapText

Visibility: public
Declaration

Delphi
procedure SetCellWrapText(ASheet: TWorksheet; const ACell: string; AWrap: Boolean);
C++
void __fastcall SetCellWrapText(
  TWorksheet* ASheet,
  const System::UnicodeString ACell,
  bool AWrap
);

Where used: Wrap flag without a cell ref variable.

How to use:

begin
  SetCellWrapText(MagiXells1.ActiveSheet, 'A1', True);
end;

MagiXellsSheetIndexOf

Visibility: public
Declaration

Delphi
function MagiXellsSheetIndexOf(AWorkbook: TWorkbook; ASheet: TWorksheet): Integer;
C++
int __fastcall MagiXellsSheetIndexOf(TWorkbook* AWorkbook, TWorksheet* ASheet);

Where used: Map a worksheet pointer to its 0-based workbook index (-1 if missing). Used internally by SheetAPI; useful for control APIs that take sheet indexes.

How to use:

var
  I: Integer;
begin
  I := MagiXellsSheetIndexOf(MagiXells1.Workbook, MagiXells1.ActiveSheet);
end;

MagiXellsAddChart

Visibility: public
Declaration

Delphi
function MagiXellsAddChart(AWorkbook: TWorkbook; ASheet: TWorksheet; const ATitle: string; AChartType: TSheetChartType; const ASeries: TArray<TSheetChartSeries>; const AAnchorA1: string; AWidthCols: Integer = 8; AHeightRows: Integer = 12): TSheetDrawing;
C++
TSheetDrawing* __fastcall MagiXellsAddChart(
  TWorkbook* AWorkbook,
  TWorksheet* ASheet,
  const System::UnicodeString ATitle,
  TSheetChartType AChartType,
  const System::DynamicArray<TSheetChartSeries> &ASeries,
  const System::UnicodeString AAnchorA1,
  int AWidthCols = 8,
  int AHeightRows = 12
);

Where used: Lower-level chart helper (also used by AI tools). Prefer TAuthoringSheet.AddChart in application code.

How to use:

var
  Series: TArray<TSheetChartSeries>;
  Ser: TSheetChartSeries;
begin
  Ser := Default(TSheetChartSeries);
  Ser.Title := 'Qty';
  Ser.ValuesFormula := 'Sheet1!$B$2:$B$5';
  Ser.CategoriesFormula := 'Sheet1!$A$2:$A$5';
  Ser.PlotKind := sctLine;
  Series := [Ser];
  MagiXellsAddChart(MagiXells1.Workbook, MagiXells1.ActiveSheet,
    'Title', sctLine, Series, 'E2', 8, 12);
end;

MagiXellsAddPictureBytes

Visibility: public
Declaration

Delphi
function MagiXellsAddPictureBytes(AWorkbook: TWorkbook; ASheet: TWorksheet; const ABytes: TBytes; const AContentType, AAnchorA1: string; AWidthPx, AHeightPx: Integer): TSheetDrawing;
C++
TSheetDrawing* __fastcall MagiXellsAddPictureBytes(
  TWorkbook* AWorkbook,
  TWorksheet* ASheet,
  const System::DynamicArray<System::Byte> ABytes,
  const System::UnicodeString AContentType,
  const System::UnicodeString AAnchorA1,
  int AWidthPx,
  int AHeightPx
);

Where used: Low-level picture embed; prefer AddPictureFromBytes on TAuthoringSheet.

How to use:

var
  Bytes: TBytes;
begin
  Bytes := TFile.ReadAllBytes('C:\Assets\logo.png');
  MagiXellsAddPictureBytes(MagiXells1.Workbook, MagiXells1.ActiveSheet,
    Bytes, 'image/png', 'G2', 240, 180);
end;

MagiXellsSortRange

Visibility: public
Declaration

Delphi
procedure MagiXellsSortRange(AWorkbook: TWorkbook; ASheet: TWorksheet; const ARangeA1: string; const AKeys: TArray<TSheetSortKey>; AHasHeader: Boolean);
C++
void __fastcall MagiXellsSortRange(
  TWorkbook* AWorkbook,
  TWorksheet* ASheet,
  const System::UnicodeString ARangeA1,
  const System::DynamicArray<TSheetSortKey> &AKeys,
  bool AHasHeader
);

Where used: Low-level sort; prefer TAuthoringSheet.Sort.

How to use:

var
  Keys: TArray<TSheetSortKey>;
begin
  SetLength(Keys, 1);
  Keys[0].Col := 1;
  Keys[0].Ascending := True;
  MagiXellsSortRange(MagiXells1.Workbook, MagiXells1.ActiveSheet,
    'A1:C10', Keys, True);
end;

End-to-end examples

Format a table block

procedure FormatSalesTable(AGrid: TMagiXells);
var
  S: TAuthoringSheet;
  Rows: TArray<TArray<Variant>>;
begin
  S := AGrid.Workbook.UseActiveSheet;

  SetLength(Rows, 4);
  Rows[0] := TArray<Variant>.Create('Product', 'Qty', 'Price');
  Rows[1] := TArray<Variant>.Create('Widget', 3, 9.5);
  Rows[2] := TArray<Variant>.Create('Gadget', 1, 20);
  Rows[3] := TArray<Variant>.Create('Doohickey', 5, 4.25);
  S.Range('A1:C4').SetValues(Rows);

  S.Range('A1:C1').FontBold := True;
  S.Range('A1:C1').FillColor := TColor($4472C4);
  S.Range('A1:C1').FontColor := TColor($FFFFFF);
  S.Range('A1:C1').HorizontalAlignment := haCenter;
  S.Range('C2:C4').NumberFormat := '$#,##0.00';
  S.Range('A1:C4').BorderAround(blsThin);
  S.Range('A1:C4').BorderInside(blsHair);

  S.SetColWidthChars(1, 3, 14);  { 1-based: A..C }
  S.Freeze(1, 0);
  S.AddTable('Sales', 'A1:C4', True, True);
end;

Chart from categories + values

procedure AddSalesChart(AGrid: TMagiXells);
var
  S: TAuthoringSheet;
  SheetName: string;
begin
  S := AGrid.Workbook.UseActiveSheet;
  SheetName := S.Sheet.Name;

  S.Cell['A1'].Text := 'Month';
  S.Cell['B1'].Text := 'Sales';
  S.Cell['A2'].Text := 'Jan'; S.Cell['B2'].AsNumber := 10;
  S.Cell['A3'].Text := 'Feb'; S.Cell['B3'].AsNumber := 18;
  S.Cell['A4'].Text := 'Mar'; S.Cell['B4'].AsNumber := 14;
  S.Range('A1:B1').FontBold := True;

  S.AddChart('Monthly sales', sctColumn,
    SheetName + '!$B$2:$B$4',
    SheetName + '!$A$2:$A$4',
    'D2', 8, 12);
end;

Sort a filtered range

procedure SortByQtyDescending(AGrid: TMagiXells);
var
  S: TAuthoringSheet;
  Keys: TArray<TSheetSortKey>;
begin
  S := AGrid.Workbook.UseActiveSheet;
  S.EnableAutoFilter('A1:C10');

  SetLength(Keys, 1);
  Keys[0].Col := 2;       { 1-based offset within A:C → column B }
  Keys[0].Ascending := False;
  S.Sort('A1:C10', Keys, True);
end;

Pivot summary

procedure BuildRegionPivot(AGrid: TMagiXells);
var
  S: TAuthoringSheet;
  P: TPivotTable;
begin
  S := AGrid.Workbook.UseActiveSheet;
  { Assume A1:C20 has headers Region, Product, Amount }
  P := S.AddPivotTable('ByRegion', 'A1:C20', 'E1');
  P.AddField(TPivotFieldRef.Create(0, pfrRow));           { Region — 0-based field }
  P.AddField(TPivotFieldRef.Create(2, pfrValue, paSum));  { Amount }
  S.RefreshPivotTable('ByRegion');
  S.AddPivotChart('ByRegion', 'H1', 8, 12);
end;

See also

AI agent API

Public types, TMagiXellsAIAgent, host adapters, and the tool catalog the LLM can call.

Units: MagiXells.AI.Types, MagiXells.AI.Agent, MagiXells.AI.Host, MagiXells.AI.Host.Vcl / MagiXells.AI.Host.Fmx, MagiXells.AI.Tools
C++Builder: matching .hpp headers — see C++Builder and AI guide.

Trial/Runtime installs ship compiled packages only (no library .pas). Use this page as the contract for the agent surface.

All members below are public unless noted.

uses
  MagiXells.AI.Types,
  MagiXells.AI.Agent,
  MagiXells.AI.Host.Vcl;   { or MagiXells.AI.Host.Fmx }

var
  Config: TMagiXellsAIConfig;
  Agent: TMagiXellsAIAgent;
begin
  Config := TMagiXellsAIConfig.Default;
  Config.Provider := aipOpenAICompatible;
  Config.BaseUrl := 'https://api.openai.com/v1';
  Config.ApiKey := GetEnvironmentVariable('MAGIXELLS_AI_API_KEY');
  Config.Model := 'gpt-4o-mini';

  Agent := TMagiXellsAIAgent.Create(Config);
  Agent.Host := TMagiXellsAIHost.Create(MagiXells1);
  Agent.OnFinished := AgentFinished;
  Agent.RunAsync('Build a one-page sales summary with a column chart');
end;

Convention: You own the chat UI. Wire Host to a spreadsheet adapter, then call Run / RunAsync. Tools mutate the workbook through undoable host commands — do not invent tool names; the catalog below matches MagiXellsAIToolDefinitions (87 tools).


Enumerations

TMagiXellsAIProvider

Visibility: public
Declaration

Delphi
TMagiXellsAIProvider = (aipOpenAICompatible, aipAnthropic);
C++
enum class TMagiXellsAIProvider { aipOpenAICompatible, aipAnthropic };
Value Meaning
aipOpenAICompatible OpenAI Chat Completions–compatible HTTP API (BaseUrl ends in /v1)
aipAnthropic Anthropic Messages API

Where used: TMagiXellsAIConfig.Provider before Create / UpdateConfig.

How to use:

Config.Provider := aipOpenAICompatible;
Config.BaseUrl := 'http://127.0.0.1:11434/v1';  { local OpenAI-compatible }
{ or }
Config.Provider := aipAnthropic;
Config.BaseUrl := 'https://api.anthropic.com';

TMagiXellsAIRole

Visibility: public
Declaration

Delphi
TMagiXellsAIRole = (airSystem, airUser, airAssistant, airTool);
C++
enum class TMagiXellsAIRole { airSystem, airUser, airAssistant, airTool };

Where used: OnMessage callbacks and MagiXellsAIRoleToString when logging transcript lines.

How to use:

procedure TForm1.AgentMessage(Sender: TObject; const ARole: TMagiXellsAIRole;
  const AText: string);
begin
  Memo1.Lines.Add(MagiXellsAIRoleToString(ARole) + ': ' + AText);
end;

TMagiXellsAIConfig

Visibility: public (record fields)

Field Type Notes
Provider TMagiXellsAIProvider aipOpenAICompatible / aipAnthropic
BaseUrl string API base URL
ApiKey string Optional for local OpenAI-compatible servers
Model string Model id
MaxTokens Integer 0 = auto from context window
Temperature Double Default 0.2
MaxToolRounds Integer Default 40 — max tool-loop iterations per run
TimeoutMs Integer Default 120000
ReasoningEffort string '' / none / low / medium / high

Where used: Construct the agent, or pass to UpdateConfig when the user changes model/provider in your settings UI.

How to use:

Config := TMagiXellsAIConfig.Default;
Config.Provider := aipOpenAICompatible;
Config.BaseUrl := 'https://api.openai.com/v1';
Config.ApiKey := GetEnvironmentVariable('MAGIXELLS_AI_API_KEY');
Config.Model := 'gpt-4o-mini';
Config.MaxToolRounds := 40;
Config.TimeoutMs := 120000;
Config.Temperature := 0.2;
Config.MaxTokens := 0;
Config.ReasoningEffort := '';  { or none|low|medium|high }

Default

Visibility: public
Declaration

Delphi
class function Default: TMagiXellsAIConfig; static;
C++
static TMagiXellsAIConfig __fastcall Default();

Where used: Starting point for every host settings dialog; fills safe defaults then you override Provider/URL/key/model.

How to use:

Config := TMagiXellsAIConfig.Default;
Config.Model := 'gpt-4o-mini';
Agent := TMagiXellsAIAgent.Create(Config);

Message / tool types

TMagiXellsAIModelInfo

Visibility: public — Id, ContextLength

Where used: Populate a model picker with context-window hints after ListModelInfos.

How to use:

var
  Infos: TArray<TMagiXellsAIModelInfo>;
  I: Integer;
begin
  Infos := Agent.ListModelInfos;
  for I := 0 to High(Infos) do
    Memo1.Lines.Add(Format('%s  ctx=%d', [Infos[I].Id, Infos[I].ContextLength]));
end;

TMagiXellsAIToolCall

Visibility: public — Id, Name, ArgumentsJson

Where used: OnToolStart / OnToolCall when you show “agent is calling …” or log tool I/O; also if you call MagiXellsAIExecuteTool yourself.

How to use:

procedure TForm1.AgentToolCall(Sender: TObject; const ACall: TMagiXellsAIToolCall;
  const AResult: string);
begin
  Memo1.Lines.Add(ACall.Name + ' ' + ACall.ArgumentsJson);
  Memo1.Lines.Add('  => ' + AResult);
end;

TMagiXellsAIImagePart

Visibility: public — MimeType, Base64Data, FileName; factories FromFile / FromBytes; DataUrl, GuessMime

Where used: Multimodal user messages (describe a chart screenshot, OCR a printed sheet photo).

How to use:

var
  Part: TMagiXellsAIImagePart;
  Msg: TMagiXellsAIMessage;
begin
  Part := TMagiXellsAIImagePart.FromFile('chart.png');
  Msg := TMagiXellsAIMessage.UserWithImages('Describe this chart', [Part]);
  { Host chat UIs that inject history use Msg; typical demos send text via Run/RunAsync }
end;

TMagiXellsAIMessage

Visibility: public — Role, Content, ToolCallId, ToolName, ToolCalls, Images; factories below; HasImages

Where used: Building or inspecting agent history (GetHistory), custom system prompts in advanced hosts, vision messages.

How to use:

var
  M: TMagiXellsAIMessage;
begin
  M := TMagiXellsAIMessage.System('You are a spreadsheet assistant');
  M := TMagiXellsAIMessage.User('Add totals for column B');
  M := TMagiXellsAIMessage.Assistant('Done — totals are in B12.');
end;

System / User / UserWithImages / Assistant / AssistantTools / ToolResult

Visibility: public class functions on TMagiXellsAIMessage

Where used: Same as above; AssistantTools / ToolResult are mainly for reconstructing transcripts.

How to use: Prefer User / System when seeding; let Run/RunAsync own the tool-loop messages unless you are writing a custom agent shell.

TMagiXellsAIToolDef

Visibility: public — Name, Description, ParametersJsonSchema

Where used: Inspecting what the agent exposes (MagiXellsAIToolDefinitions); documenting or filtering tools in a host UI.

How to use:

var
  Defs: TArray<TMagiXellsAIToolDef>;
  I: Integer;
begin
  Defs := MagiXellsAIToolDefinitions;
  for I := 0 to High(Defs) do
    ListBox1.Items.Add(Defs[I].Name);
end;

TMagiXellsAIChatResponse

Visibility: public — Content, ReasoningContent, ToolCalls, FinishReason, RawJson; helpers HasToolCalls, IsEmpty, WasTruncated

Where used: Low-level HTTP client (MagiXells.AI.Client); application code normally uses agent events instead.

How to use: Prefer OnMessage / OnToolCall / OnFinished on TMagiXellsAIAgent. Use response helpers only if you integrate the client directly.

MagiXellsAIRoleToString

Visibility: public
Declaration

Delphi
function MagiXellsAIRoleToString(ARole: TMagiXellsAIRole): string;
C++
System::UnicodeString __fastcall MagiXellsAIRoleToString(TMagiXellsAIRole ARole);

Where used: Logging and chat transcript labels.

How to use:

S := MagiXellsAIRoleToString(airUser);  { 'user' }

EMagiXellsAIError

Visibility: public (class(Exception))

Where used: Raised for invalid vision payloads, missing image files, and some client failures. Catch around FromFile / agent setup if you want a friendly message.

How to use:

try
  Part := TMagiXellsAIImagePart.FromFile(UserPath);
except
  on E: EMagiXellsAIError do
    ShowMessage(E.Message);
end;

Event types

TMagiXellsAIStatusEvent

Visibility: public
Declaration

Delphi
procedure(Sender: TObject; APercent: Integer; const AStatus: string; AIndeterminate: Boolean) of object
C++
typedef void __fastcall (__closure *)(
  System::TObject* Sender,
  int APercent,
  const System::UnicodeString AStatus,
  bool AIndeterminate
);

Where used: Status bar / progress while HTTP or tools run.

TMagiXellsAIMessageEvent

Visibility: public
Declaration

Delphi
procedure(Sender: TObject; const ARole: TMagiXellsAIRole; const AText: string) of object
C++
typedef void __fastcall (__closure *)(
  System::TObject* Sender,
  const TMagiXellsAIRole ARole,
  const System::UnicodeString AText
);

Where used: Append assistant/user text to your chat memo.

TMagiXellsAIToolStartEvent / TMagiXellsAIToolCallEvent

Visibility: public
Signatures: start (Sender; ACall); call (Sender; ACall; AResult)

Where used: Show “calling tool …” then the result JSON/text.

TMagiXellsAIConfirmToolEvent

Visibility: public
Declaration

Delphi
function(Sender: TObject; const AToolName, AArgumentsJson: string): Boolean of object
C++
typedef bool __fastcall (__closure *)(
  System::TObject* Sender,
  const System::UnicodeString AToolName,
  const System::UnicodeString AArgumentsJson
);

Where used: Gate destructive tools (delete_sheet, print, …) with a Yes/No dialog. Return False to skip the tool.

TMagiXellsAIFinishedEvent

Visibility: public
Declaration

Delphi
procedure(Sender: TObject; const AFinalText, AError: string) of object; { AError empty on success }
C++
typedef void __fastcall (__closure *)(
  System::TObject* Sender,
  const System::UnicodeString AFinalText,
  const System::UnicodeString AError
);

Where used: Re-enable Run button after RunAsync; show final reply or error.


TMagiXellsAIAgent

Create

Visibility: public
Declaration

Delphi
constructor Create; overload;
constructor Create(const AConfig: TMagiXellsAIConfig); overload;
C++
__fastcall Create() /* overload */;
__fastcall Create(const TMagiXellsAIConfig AConfig) /* overload */;

Where used: Form/field lifetime of your AI panel; parameterless form uses TMagiXellsAIConfig.Default.

How to use:

Agent := TMagiXellsAIAgent.Create(Config);
{ or }
Agent := TMagiXellsAIAgent.Create;  { then UpdateConfig }

Destroy

Visibility: public

Where used: Form destroy / FreeAndNil when the panel closes. Cancels in-flight work.

How to use:

Agent.Free;

UpdateConfig

Visibility: public
Declaration

Delphi
procedure UpdateConfig(const AConfig: TMagiXellsAIConfig);
C++
void __fastcall UpdateConfig(const TMagiXellsAIConfig AConfig);

Where used: After the user edits API key, model, or base URL in settings.

How to use:

Config.Model := cbModel.Text;
Agent.UpdateConfig(Config);

ClearHistory

Visibility: public

Where used: “New chat” button so the next prompt does not carry prior tool context.

How to use:

Agent.ClearHistory;
Memo1.Clear;

GetHistory

Visibility: public
Declaration

Delphi
function GetHistory: TArray<TMagiXellsAIMessage>;
C++
System::DynamicArray<TMagiXellsAIMessage> __fastcall GetHistory();

Where used: Persist/export the conversation, or debug what the agent remembers.

How to use:

var
  Hist: TArray<TMagiXellsAIMessage>;
  I: Integer;
begin
  Hist := Agent.GetHistory;
  for I := 0 to High(Hist) do
    Memo1.Lines.Add(MagiXellsAIRoleToString(Hist[I].Role) + ': ' + Hist[I].Content);
end;

Cancel

Visibility: public

Where used: Stop button while Busy.

How to use:

if Agent.Busy then
  Agent.Cancel;

ListModels

Visibility: public
Declaration

Delphi
function ListModels: TArray<string>;
C++
System::DynamicArray<string> __fastcall ListModels();

Where used: Fill a model combo from the provider’s /models (or equivalent) endpoint.

How to use:

for S in Agent.ListModels do
  cbModel.Items.Add(S);

ListModelInfos

Visibility: public
Declaration

Delphi
function ListModelInfos: TArray<TMagiXellsAIModelInfo>;
C++
System::DynamicArray<TMagiXellsAIModelInfo> __fastcall ListModelInfos();

Where used: Same as ListModels, with context lengths for UI hints / token budgeting.

How to use:

Infos := Agent.ListModelInfos;

ActiveModelContextLength

Visibility: public
Declaration

Delphi
function ActiveModelContextLength: Integer;
C++
int __fastcall ActiveModelContextLength();

Where used: Show “context window” for the currently configured model, or decide how much sheet context to inject.

How to use:

N := Agent.ActiveModelContextLength;
StatusBar1.SimpleText := Format('Context: %d tokens', [N]);

Run

Visibility: public
Declaration

Delphi
function Run(const AUserPrompt: string): string;
C++
System::UnicodeString __fastcall Run(const System::UnicodeString AUserPrompt);

Blocking on the calling thread.

Where used: Console tools, background workers, or tests. Avoid on the UI thread for long tool loops.

How to use:

Reply := Agent.Run('Summarize sheet 1 used range');
ShowMessage(Reply);

RunAsync

Visibility: public
Declaration

Delphi
procedure RunAsync(const AUserPrompt: string);
C++
void __fastcall RunAsync(const System::UnicodeString AUserPrompt);

HTTP on a worker; tools/UI/OnFinished on the main thread.

Where used: Normal VCL/FMX chat “Send” button.

How to use:

btnRun.Enabled := False;
Agent.RunAsync('Create a sales table with a chart');
{ re-enable in OnFinished }

Config

Visibility: public
Declaration

Delphi
property Config: TMagiXellsAIConfig read FConfig;
C++
__property TMagiXellsAIConfig Config;

Where used: Read-only snapshot of the last applied config (display current model in a label).

How to use:

lblModel.Caption := Agent.Config.Model;

Host

Visibility: public
Declaration

Delphi
property Host: IMagiXellsAIHost read FHost write SetHost;
C++
__property _di_IMagiXellsAIHost Host;

Where used: Must be set before tools that touch the sheet; typically once after creating the adapter.

How to use:

Agent.Host := TMagiXellsAIHost.Create(MagiXells1);

Busy

Visibility: public
Declaration

Delphi
property Busy: Boolean read FBusy;
C++
__property bool Busy;

Where used: Disable Send while a run is in progress; enable Cancel.

How to use:

btnRun.Enabled := not Agent.Busy;
btnCancel.Enabled := Agent.Busy;

OnStatus

Visibility: public
Declaration

Delphi
property OnStatus: TMagiXellsAIStatusEvent;
C++
__property TMagiXellsAIStatusEvent OnStatus;

Where used: Progress / status text during HTTP and tool rounds.

How to use:

procedure TForm1.AgentStatus(Sender: TObject; APercent: Integer;
  const AStatus: string; AIndeterminate: Boolean);
begin
  if AIndeterminate then
    StatusBar1.SimpleText := AStatus
  else
    StatusBar1.SimpleText := Format('%d%% %s', [APercent, AStatus]);
end;

Agent.OnStatus := AgentStatus;

OnMessage

Visibility: public
Declaration

Delphi
property OnMessage: TMagiXellsAIMessageEvent;
C++
__property TMagiXellsAIMessageEvent OnMessage;

Where used: Stream transcript lines into your chat UI.

How to use:

procedure TForm1.AgentMessage(Sender: TObject; const ARole: TMagiXellsAIRole;
  const AText: string);
begin
  Memo1.Lines.Add(MagiXellsAIRoleToString(ARole) + ': ' + AText);
end;

Agent.OnMessage := AgentMessage;

OnToolStart

Visibility: public
Declaration

Delphi
property OnToolStart: TMagiXellsAIToolStartEvent;
C++
__property TMagiXellsAIToolStartEvent OnToolStart;

Where used: Show that a tool is about to run (before result).

How to use:

procedure TForm1.AgentToolStart(Sender: TObject; const ACall: TMagiXellsAIToolCall);
begin
  Memo1.Lines.Add('→ ' + ACall.Name);
end;

Agent.OnToolStart := AgentToolStart;

OnToolCall

Visibility: public
Declaration

Delphi
property OnToolCall: TMagiXellsAIToolCallEvent;
C++
__property TMagiXellsAIToolCallEvent OnToolCall;

Where used: Log tool name + arguments + result after execution.

How to use:

procedure TForm1.AgentToolCall(Sender: TObject; const ACall: TMagiXellsAIToolCall;
  const AResult: string);
begin
  Memo1.Lines.Add(ACall.Name + ' => ' + AResult);
end;

Agent.OnToolCall := AgentToolCall;

OnConfirmTool

Visibility: public
Declaration

Delphi
property OnConfirmTool: TMagiXellsAIConfirmToolEvent;
C++
__property TMagiXellsAIConfirmToolEvent OnConfirmTool;

Where used: Optional safety gate before mutations the host considers sensitive.

How to use:

function TForm1.AgentConfirmTool(Sender: TObject; const AToolName,
  AArgumentsJson: string): Boolean;
begin
  Result := MessageDlg('Allow ' + AToolName + '?', mtConfirmation, [mbYes, mbNo], 0) = mrYes;
end;

Agent.OnConfirmTool := AgentConfirmTool;

OnFinished

Visibility: public
Declaration

Delphi
property OnFinished: TMagiXellsAIFinishedEvent;
C++
__property TMagiXellsAIFinishedEvent OnFinished;

Where used: End of RunAsync (always on main thread) — success text or error.

How to use:

procedure TForm1.AgentFinished(Sender: TObject; const AFinalText, AError: string);
begin
  if AError <> '' then
    ShowMessage(AError)
  else
    Memo1.Lines.Add(AFinalText);
  btnRun.Enabled := True;
end;

Agent.OnFinished := AgentFinished;

Host adapters

IMagiXellsAIHost

Visibility: public interface (MagiXells.AI.Host)

Where used: Implemented by TMagiXellsAIHost / TFmxMagiXellsAIHost; consumed by the agent and MagiXellsAIExecuteTool. Application code rarely calls interface methods directly.

How to use: Assign an adapter instance to Agent.Host. Prefer SheetAPI / control APIs for your own authoring; let tools go through the host.

TMagiXellsAIHost.Create

Visibility: public
Unit: MagiXells.AI.Host.Vcl
Declaration

Delphi
constructor Create(ASpreadsheet: TMagiXells);
C++
__fastcall Create(TMagiXells* ASpreadsheet);

Where used: VCL demos and host apps that embed TMagiXells.

How to use:

Agent.Host := TMagiXellsAIHost.Create(MagiXells1);

TFmxMagiXellsAIHost.Create

Visibility: public
Unit: MagiXells.AI.Host.Fmx
Declaration

Delphi
constructor Create(ASpreadsheet: TFmxMagiXells);
C++
__fastcall Create(TFmxMagiXells* ASpreadsheet);

Where used: FMX demos and host apps that embed TFmxMagiXells.

How to use:

Agent.Host := TFmxMagiXellsAIHost.Create(FmxMagiXells1);

Tool surface (MagiXells.AI.Tools)

MagiXellsAIToolDefinitions

Visibility: public
Declaration

Delphi
function MagiXellsAIToolDefinitions: TArray<TMagiXellsAIToolDef>;
C++
System::DynamicArray<TMagiXellsAIToolDef> __fastcall MagiXellsAIToolDefinitions();

Where used: Agent startup (schemas sent to the model); host UIs that list available tools.

How to use:

Defs := MagiXellsAIToolDefinitions;
ShowMessage(Format('%d tools', [Length(Defs)]));

MagiXellsAIExecuteTool

Visibility: public
Declaration

Delphi
function MagiXellsAIExecuteTool(AHost: IMagiXellsAIHost; const ACall: TMagiXellsAIToolCall): string;
C++
System::UnicodeString __fastcall MagiXellsAIExecuteTool(
  _di_IMagiXellsAIHost AHost,
  const TMagiXellsAIToolCall* ACall
);

Where used: Agent tool loop; rarely called from app code unless you are replaying a recorded tool call.

How to use:

ResultText := MagiXellsAIExecuteTool(Agent.Host, Call);

Tool catalog (87 tools)

Each tool is invoked by the LLM with JSON arguments. Mutations are undoable through the host. Grouped by category. For each tool: Where used = typical agent prompt / effect; How to use = example user prompt or argument/effect sketch (do not call these as Delphi APIs from your app — prompt the agent or use SheetAPI).

Read / inspect

get_workbook_overview

Where used: First look at sheets, active sheet, used range, selection, named ranges.
How to use: Prompt: “What sheets are in this workbook and what’s selected?”

get_range

Args: range (required)
Where used: Read values/formulas before editing.
How to use: Prompt: “Show me A1:D20 on the active sheet.”

get_selection

Where used: Inspect the current UI selection and nearby cells.
How to use: Prompt: “What’s in the current selection?”

explain_formula

Args: address
Where used: Explain a cell’s formula and cached result.
How to use: Prompt: “Explain the formula in C12.”

evaluate_formula

Args: formula
Where used: Compute an expression without writing a cell.
How to use: Prompt: “What is =SUM(B2:B100) right now?”

list_formula_errors

Args: optional range
Where used: Find #DIV/0!, #N/A, etc.
How to use: Prompt: “List formula errors on this sheet.”

find_cells

Args: text (+ optional range, match_case, search_formulas)
Where used: Locate text or formula substrings.
How to use: Prompt: “Find cells containing ‘Acme’.”

list_named_ranges

Where used: Enumerate workbook names before edit/delete.
How to use: Prompt: “List all named ranges.”

list_drawings

Where used: Inventory shapes, charts, pictures, overlays.
How to use: Prompt: “What floating objects are on this sheet?”


Cells, formatting, clear

set_cells

Args: cells[] with address, kind (text|number|formula|boolean|empty), value fields
Where used: Batch write entire tables (preferred over one cell per call).
How to use: Prompt: “Fill A1:C3 with Month/Sales headers and two data rows.”
Effect sketch:

{
  "cells": [
    { "address": "A1", "kind": "text", "text": "Month" },
    { "address": "B1", "kind": "text", "text": "Sales" },
    { "address": "A2", "kind": "text", "text": "Jan" },
    { "address": "B2", "kind": "number", "number": 100 },
    { "address": "C2", "kind": "formula", "formula": "=B2*1.1" }
  ]
}

format_range

Args: range, format (font/fill/border/alignment/number_format)
Where used: Style headers, currency columns, borders without selecting first.
How to use: Prompt: “Bold A1:C1 and format B2:B20 as currency.”

clear_range

Args: range (+ contents/formats) — does not delete charts
Where used: Wipe values/formats in a block.
How to use: Prompt: “Clear contents in A1:F50 but keep formatting.”

replace_cells

Args: find, replace (+ range, flags)
Where used: Bulk find/replace in values or formulas.
How to use: Prompt: “Replace ‘Q1’ with ‘Qtr1’ in A1:Z100.”

fill_range

Args: range, direction (down|right|up|left)
Where used: Extend a formula/value along a block.
How to use: Prompt: “Fill the formula in C2 down through C50.”


Rows, columns, merge

insert_rows / insert_columns

Args: start_row or start_col (+ count); 1-based
Where used: Make room for new data.
How to use: Prompt: “Insert 2 rows starting at row 5.”

delete_rows / delete_columns

Args: start_row / start_col (+ count)
Where used: Remove unused structure.
How to use: Prompt: “Delete columns C through E.”

merge_cells / unmerge_cells

Args: range
Where used: Title banners / undo merges.
How to use: Prompt: “Merge A1:D1 for the report title.”

hide_rows / hide_columns

Args: row span or columns / col indexes (+ hidden)
Where used: Collapse detail rows/cols.
How to use: Prompt: “Hide rows 20–30.”

set_outline_level / show_outline_level

Args: axis (rows|columns), levels
Where used: Group/outline like Excel.
How to use: Prompt: “Group rows 5–15 at outline level 1.”


Sheets & names

add_sheet

Args: optional name, activate
Where used: New worksheet for a report.
How to use: Prompt: “Add a sheet named Summary and activate it.”

rename_sheet

Args: name (+ optional index)
Where used: Rename tabs.
How to use: Prompt: “Rename the active sheet to Sales 2026.”

activate_sheet

Args: index (0-based)
Where used: Switch context before edits.
How to use: Prompt: “Activate the second sheet.”

delete_sheet

Args: index — only for empty/near-empty duplicates
Where used: Remove accidental blank sheets.
How to use: Prompt: “Delete the empty Sheet3.” (agent should call get_workbook_overview first)

move_sheet

Args: from_index, to_index
Where used: Reorder tabs.
How to use: Prompt: “Move Summary to the first tab.”

duplicate_sheet

Args: index (+ optional name)
Where used: Copy a template sheet.
How to use: Prompt: “Duplicate Sheet1 as Sheet1 Copy.”

set_named_range

Args: name, formula
Where used: Define names for formulas/print titles.
How to use: Prompt: “Name A1:B20 as SalesData.”

delete_named_range

Args: name
Where used: Remove stale names.
How to use: Prompt: “Delete the named range TempRange.”

select_range

Args: range
Where used: Focus the UI selection for the user.
How to use: Prompt: “Select A1:C10.”


Reports, charts, pictures

create_report

Args: title, headers (+ rows, sheet_name, add_totals) — preferred for new tables
Where used: One-shot title + headers + data + optional totals.
How to use: Prompt: “Create a sales report with columns Region, Product, Amount and these three rows: …”

insert_chart

Args: values (required); optional chart_type, categories, title, anchor, size
Types: column|bar|line|pie|area|scatter|doughnut|radar
Where used: Floating chart over data.
How to use: Prompt: “Insert a column chart of B2:B10 with categories A2:A10 at D2.”

list_charts

Where used: Discover chart indexes before update/delete.
How to use: Prompt: “List charts on this sheet.”

update_chart

Args: chart_index (+ title/type/values/categories/anchor/size)
Where used: Retarget or restyle an existing chart.
How to use: Prompt: “Change chart 0 to a line chart and use B2:B20.”

delete_chart

Args: chart_index or delete_allclear_range does not remove charts
Where used: Remove floating charts.
How to use: Prompt: “Delete all charts on the active sheet.”

set_chart_legend

Args: chart_index (+ show, position)
Where used: Legend on/off and placement.
How to use: Prompt: “Hide the legend on chart 0.” / “Put the legend at the bottom.”

insert_picture

Args: source (file|url|base64|clipboard) + data/path + optional anchor, size
Where used: Logos and screenshots on the sheet.
How to use: Prompt: “Insert logo.png at E2, about 240×120 px.”

list_pictures / delete_picture

Args: delete needs picture_index
Where used: Manage floating images.
How to use: Prompt: “List pictures, then delete picture 0.”

paste_picture

Where used: Paste OS clipboard image at the active cell.
How to use: Prompt: “Paste the clipboard image onto the sheet.”


Layout & view

set_column_widths

Args: width_chars (+ columns or start_col/end_col) — Excel character units, not pixels
Where used: Fix clipped text.
How to use: Prompt: “Set columns A:C to 14 characters wide.”

set_row_heights

Args: start_row, height_pt (+ end_row) — points (1/72 inch)
Where used: Taller header rows.
How to use: Prompt: “Set row 1 height to 24 pt.”

autofit_columns

Args: optional column span; omit = used range
Where used: Auto-size when content is truncated.
How to use: Prompt: “Autofit columns A:F.”

freeze_panes

Args: rows, cols — both 0 unfreezes
Where used: Keep headers visible while scrolling.
How to use: Prompt: “Freeze the top row and first column.”

set_zoom

Args: percent (10–400)
Where used: Zoom the sheet view.
How to use: Prompt: “Set zoom to 125%.”

set_rtl

Args: rtl
Where used: Sheet right-to-left layout.
How to use: Prompt: “Turn on right-to-left for this sheet.”

set_view

Args: optional gridlines, headers, formulas, zeros
Where used: Toggle grid/headers/show-formulas/zeros.
How to use: Prompt: “Show formulas instead of values.”


Tables, sort, filter, AutoFilter

list_tables / create_table / delete_table

Args: create needs range (+ name, has_header, show_filter); delete needs name
Where used: Excel-style tables.
How to use: Prompt: “Create a table named SalesTable over A1:D50 with header and filter.”

sort_range

Args: range (+ key_col/ascending/has_header or keys[])
Where used: Sort data blocks.
How to use: Prompt: “Sort A1:D100 by column C descending, has header.”

filter_column / clear_filter

Args: filter needs range, match (+ col, contains/case)
Where used: Simple AutoFilter criteria / clear.
How to use: Prompt: “Filter A1:D100 so column B contains ‘West’.”

set_autofilter / clear_autofilter / set_autofilter_column

Args: set needs range; column needs col (+ match/values)
Where used: Enable filter buttons and per-column criteria.
How to use: Prompt: “Enable AutoFilter on A1:E1 and show only rows where col 2 is East or West.”


Clipboard

copy_range / cut_range

Args: range
Where used: Clipboard ops before paste.
How to use: Prompt: “Copy A1:C10.”

paste

Args: optional mode (all|values|formulas|formats)
Where used: Paste at selection.
How to use: Prompt: “Paste values only at the current selection.”


list_validations / set_list_validation / clear_validations

Args: set needs range, list (CSV or formula); clear optional range
Where used: Dropdown lists and cleanup.
How to use: Prompt: “Add a dropdown on D2:D100 with Red,Green,Blue.”

Args: address (+ target for set)
Where used: Cell links.
How to use: Prompt: “Link A1 to https://example.com.”

set_comment / get_comment / clear_comment / list_comments

Args: set needs address, text (+ author)
Where used: Notes on cells.
How to use: Prompt: “Add a comment on B2: ‘Verify against GL’.”

add_conditional_format / list_conditional_formats / clear_conditional_formats

Args: add needs range, operator, formula1 (+ colors/bold/formula2)
Where used: Highlight rules.
How to use: Prompt: “Highlight C2:C100 red when the value is greater than 1000.”


Args: print optional show_dialog (default true)
Where used: Preview or print from chat.
How to use: Prompt: “Open print preview.” / “Print the sheet with the dialog.”

set_print_area

Args: range and/or clear
Where used: Limit what prints.
How to use: Prompt: “Set print area to A1:G40.”

protect_sheet

Args: protect
Where used: Lock/unlock the active sheet.
How to use: Prompt: “Protect this sheet.”

undo / redo

Where used: Reverse or reapply the last agent/host edit.
How to use: Prompt: “Undo the last change.”


Code export

export_sheet_delphi

Args: optional range, proc_name, max_cells
Where used: Generate MagiXells SheetAPI Delphi that rebuilds the sheet.
How to use: Prompt: “Export this sheet as Delphi MagiXells code.”

export_sheet_cpp

Args: optional range, proc_name, max_cells
Where used: Generate MagiXells C++Builder SheetAPI that rebuilds the sheet.
How to use: Prompt: “Give me C++ Builder code to recreate A1:F20.”


Pivot tables

list_pivots

Where used: See existing pivots (name, source, dest, fields).
How to use: Prompt: “List pivot tables on this sheet.”

create_pivot

Args: source_range (+ dest, name, rows/columns/values/filters, refresh)
Values: Field:agg e.g. Amount:sum; agg sum|count|average|min|max
Where used: Cross tables / summarize-by.
How to use: Prompt: “Create a pivot from A1:D100 with Region on rows, Product on columns, Amount:sum as values.”

configure_pivot

Args: optional name, field lists, clear_layout, refresh
Where used: Change layout of an existing pivot.
How to use: Prompt: “Reconfigure the SalesPT pivot: clear layout, rows=Region, values=Amount:average.”

refresh_pivot

Args: optional name
Where used: Rebuild after source data changes.
How to use: Prompt: “Refresh the pivot table.”

delete_pivot

Args: optional name
Where used: Remove a pivot.
How to use: Prompt: “Delete pivot SalesPT.”


End-to-end prompt examples

Build a one-page sales summary: title, headers Month/Sales, three rows of sample data,
totals, format the header, autofit columns, and insert a column chart.
Explain B15, fix any #DIV/0! errors on the sheet, then export A1:G30 as Delphi SheetAPI code.
Create a pivot from the table in A1:D200 (Region, Product, Amount) with Region rows,
Product columns, Amount:sum values, then list pivots to confirm.

See also