TPDFlibTableExporter

Tables

Description

TPDFlibTableExporter walks any TDataSet, for example a FireDAC memory table, a ClientDataSet or a query result, and renders it as a PDFlibPas table that mirrors its fields and records

The exporter builds on the Table API (CreateTable, SetTableCellContent, DrawTableRows) and adds header styling, zebra striping and automatic page continuation

It depends only on the dataset abstraction, so it compiles with the main library and pulls in no specific dataset engine; the DataSetExport demo drives it with an in-memory table

Syntax

Delphi

TPDFlibTableExporter = Class(TObject)
  Public
    Constructor Create(APDF: TPDFlib);
    Function ExportDataSet(ADataSet: TDataSet;
      Const AOptions: TPDFlibTableExportOptions): Boolean;
    Property OnFieldFilter: TPDFlibTableFieldEvent Read FOnFieldFilter Write FOnFieldFilter;
  End;

Methods

CreateBinds the exporter to the TPDFlib instance that owns the target document
ExportDataSetRenders the dataset into the current document using the given options; the document must already have at least one page, and True is returned on success

Fields

OnFieldFilterEvent fired for each field before it is laid out; hand back a TPDFlibTableFieldSpec with Include := False to skip a field such as a binary blob or an internal key

Remarks

Fields whose data type is a binary blob are skipped automatically because they have no useful textual rendering in a cell

The document is expected to be configured for millimetres and a top-left origin; PDFlibExportDataSet performs that configuration itself

See also

PDFlibExportDataSet, DefaultTableExportOptions, TPDFlibTableExportOptions, TPDFlibTableFieldSpec, CreateTable