HotXLS-dokumentation Startsida InnehÄll Examples

Advanced Workbook Workflows

This guide groups the higher-level APIs that are most useful when a workbook workflow goes beyond basic cell reading and writing

Print-ready PDF output

Classic XLS and modern XLSX workbook, worksheet, and range PDF exports render formatted values, cell fills, font color and emphasis, alignment, borders, optional gridlines, column widths, row heights, manual page breaks, repeated print titles, and three-part headers and footers

Sheet.PageSetup.PrintArea := 'A1:H80';
Sheet.PageSetup.PrintTitleRows := '$1:$3';
Sheet.PageSetup.RightHeader := 'Page &P of &N';
Sheet.HPageBreaks.Add(45);
Workbook.SaveAsPDF('report.pdf');

Modern workbooks expose the same direct entry points through TXLSXWorkbook, TXLSXWorksheet, and TXLSXRange

ModernSheet.PrintArea := '$A$1:$H$80';
ModernSheet.PrintTitleRows := '$1:$3';
ModernSheet.AddRowBreak(45);
ModernWorkbook.SaveAsPDF('modern-report.pdf');

Text outside WinAnsi is written with an embedded TrueType CID font and a ToUnicode map so readers can render and extract Unicode text

Set TXLSPDFExport.UnicodeFontFile when a workbook needs a particular script or corporate typeface, otherwise the exporter selects a suitable installed font when available

Progress, cancellation, and diagnostics

Use OnProgressEx for begin, work, and end callbacks and set its abort argument to cancel an operation

Inspect Diagnostics or LastDiagnostic after save, open, or recalculation failures instead of relying only on a numeric return value

Unsupported OOXML package parts

TXLSXWorkbook.PreserveUnsupportedParts defaults to true and retains custom parts reachable through unknown root, workbook, worksheet, or drawing relationships

UnsupportedPartCount and UnsupportedPartBytes report retained content, while ClearUnsupportedParts intentionally removes it before a save

Rich clipboard exchange

Call range-level CopyToClipboard to publish both Unicode tabular text and CF_HTML, including display formatting, formulas, merged cells, links, and safely quoted embedded delimiters

VBA source editing

After loading a VBA project, update an existing module's SourceCode and save the workbook or standalone storage

The writer recompresses only the edited source stream while preserving stream prefixes and untouched project content

Classic form controls

CheckBox := Sheet.AddCheckBox('Approved', 2, 2, 3, 5);
ComboBox := Sheet.AddComboBox(5, 2, 6, 5);
ListBox := Sheet.AddListBox(8, 2, 12, 5);

The returned typed wrappers expose labels, control kinds, anchors, enumeration, and deletion

Selective format patches

Target.ApplyFormatPatch(Source, [xfpFont, xfpFill, xfpNumberFormat]);

A smaller source range tiles across a larger target and unselected formatting plus all destination values remain unchanged

Master-detail dataset export

Enable TDataToXLS.ReadDetailTables to export linked detail datasets below every master record and enable IndentDetailTables to add one column of indentation per relationship level

WordArt

Shape := Sheet.AddWordArt('HotXLS', 'textArchUp', 2, 2, 6, 8);
Shape.TextColor := $FF00A060;
Shape.OutlineColor := $FF17365D;

The complete DrawingML anchor survives later open and save cycles through the raw drawing preservation path

See Demo\Delphi\FeatureShowcase for a compact executable example that combines PDF printing, form controls, format patches, and WordArt

Copyright © 2010-2026 losLab Software