HotXLS Docs

TXLSPaginationModel class

TXLSPaginationModel builds an output-independent sequence of logical pages for classic XLS and modern XLSX ranges, worksheets, or workbooks

Each page carries paper geometry, margins, scale, row and column bands, repeated print titles, headers, footers, gridline policy, page order, and drawing placements

Build methods

function Build(Range: IXLSRange): Boolean; overload;
function Build(Worksheet: TXLSWorksheet): Boolean; overload;
function Build(Workbook: TXLSWorkbook): Boolean; overload;
function Build(Range: TXLSXRange): Boolean; overload;
function Build(Worksheet: TXLSXWorksheet): Boolean; overload;
function Build(Workbook: TXLSXWorkbook): Boolean; overload;

Every Build call clears the previous result, excludes hidden workbook sheets, and applies the worksheet print area when UseWorksheetPageSetup is enabled

Logical page members

DocumentPageNumberOne-based page number across the complete workbook
SheetPageNumberOne-based page number within the owning worksheet
PageWidth / PageHeightPaper dimensions in points after orientation is applied
MarginsLeft, right, top, bottom, header, and footer margins in points
ScaleResolved worksheet zoom or fit-to-page scale from 0.1 through 4
Rows / RowEdgesActual worksheet rows and their top-down page coordinates
Columns / ColumnEdgesActual worksheet columns and their left-to-right page coordinates
DrawingsPage-clipped image, chart, text-box, shape, and control placements
PrintCommentsComment rendering mode for paginated output; xpcAtEnd appends a comment listing (cell address, author, and text) below the last data row of the sheet's final page, while xpcNone omits comments

Rendering and metafiles

RenderPage draws one page into any VCL TCanvas and scales the page proportionally into caller-supplied bounds

RenderPageToBackend draws one page into a TXLSGraphicsBackenddraws one page into any VCL RenderXlsxCellsToBackend and scales the page proportionally into caller-supplied bounds

CreatePageMetafile returns an owned TMetafile, while SavePageAsMetafile writes one page directly to an EMF file

TXLSPDFExport.CreatePaginationModel returns the same model configured with the exporter's orientation, margin, and row-height defaults, and the caller owns the returned model

Example

Pages := TXLSPaginationModel.Create;
try
  if Pages.Build(Workbook) then
    Pages.SavePageAsMetafile(0, 'FirstPage.emf');
finally
  Pages.Free;
end;

See also