TTMSFNCDataGridPDFIO Class
Non-visual component that exports a grid to a PDF document. Set
DataGridand callSavewith a file name or stream.
API unit family: TMSFNCDataGridPDFIO
Inherits from: TTMSFNCCustomDataGridPDFIO
Syntax
TTMSFNCDataGridPDFIO = class(TTMSFNCCustomDataGridPDFIO)
class PASCALIMPLEMENTATION TTMSFNCDataGridPDFIO : public TTMSFNCCustomDataGridPDFIO
Remarks
Use Options for page fitting, header repetition, page size, margins, header and footer; Information for document metadata; and OnRowIsPageBreak for manual page breaks. For printer output with the same layout options use TTMSFNCDataGridPrintIO.
Properties
| Name | Description |
|---|---|
| DataGrid | Grid control whose content is exported. (inherited from TTMSFNCCustomDataGridPDFIO) |
| Options | Grid-specific export options (scaling, fit to page, repeated fixed rows and columns) plus the inherited page, header and footer settings. (inherited from TTMSFNCCustomDataGridPDFIO) |
| Renderer | Renderer that is exported when Save is called without explicit export objects. Set automatically when DataGrid is assigned; assign it directly to export a standalone renderer. (inherited from TTMSFNCCustomDataGridPDFIO) |
| Version | Component version string in Major.Minor.Release.Build format. (inherited from TTMSFNCCustomDataGridPDFIO) |
Events
| Name | Description |
|---|---|
| OnRowIsPageBreak | Occurs for every row before the export starts, so the application can force a page break before that row. (inherited from TTMSFNCCustomDataGridPDFIO) |
Usage examples
Export a DataGrid to PDF with a header and a per-page footer
Drop a TTMSFNCDataGridPDFIO, set Header / Footer, and call Save. Hook OnGetFooter for dynamic page-number text.
procedure TForm1.FormCreate(Sender: TObject);
begin
PDF.DataGrid := Grid;
PDF.Options.Header := 'TMS FNC Data Grid PDF Export';
PDF.Options.OpenInPDFReader := True; // open the result automatically
end;
procedure TForm1.ExportButtonClick(Sender: TObject);
begin
PDF.Save('gridexport.pdf');
end;
procedure TForm1.PDFGetFooter(Sender, AExportObject: TObject;
APageIndex: Integer; var AFooter: string);
begin
AFooter := Format('Page %d', [APageIndex + 1]);
end;