TMS FNC Gantt Chart Print IO — Guides
TTMSFNCGanttChartPrintIO sends a Gantt chart to a printer. It mirrors the PDF
exporter: assign the chart, choose what to include and which task-list columns
appear, set page options, then call Print. Use it when users need a paper copy
of a schedule. This guide covers printing, the print options, and page breaks.
Printing a chart
Assign GanttChart, configure GanttChartPrintExportOptions, set page
Options, and call Print:
procedure TForm1.PrintChart;
begin
GanttChartPrintIO1.GanttChart := GanttChart1;
GanttChartPrintIO1.GanttChartPrintExportOptions.Mode := emBoth;
GanttChartPrintIO1.GanttChartPrintExportOptions.TaskListColumns.Clear;
GanttChartPrintIO1.GanttChartPrintExportOptions.TaskListColumns.AddColumn('wbs', 'WBS', 80, 60);
GanttChartPrintIO1.GanttChartPrintExportOptions.TaskListColumns.AddColumn('taskname', 'Task', 160, 120);
GanttChartPrintIO1.GanttChartPrintExportOptions.TaskListColumns.AddColumn('startdate', 'Start', 90, 70);
GanttChartPrintIO1.Options.PageOrientation := TPrinterOrientation.poLandscape;
// Send the chart to the default printer.
GanttChartPrintIO1.Print;
end;
Print options
GanttChartPrintExportOptions (a TTMSFNCGanttChartExportOptions) is the same
options object the PDF exporter uses:
| Member | Effect |
|---|---|
Mode |
emBoth, emTaskList, or emTimeline — which areas are printed |
TaskListColumns |
The columns to print; build with AddColumn(field, header, width, minWidth) |
FitToPage |
Scale the timeline to fit the page width |
RepeatHeaders |
Repeat headers on every page |
TimelineUnitWidth / TimelineGroupHeight / ItemHeight |
Sizing |
Page-level settings live on Options (TTMSFNCPrintIO): PageOrientation
takes a TPrinterOrientation (poPortrait / poLandscape).
Controlling page breaks
For long task lists, OnRowIsPageBreak decides where a new page begins:
procedure TForm1.GanttChartPrintIO1RowIsPageBreak(Sender: TObject;
AExportObject: TTMSFNCPrintIOExportObject; ARow: Integer; var IsPageBreak: Boolean);
begin
// Start a new page every 30 printed rows.
IsPageBreak := (ARow > 0) and (ARow mod 30 = 0);
end;
Pitfalls
- Assign
GanttChartbefore callingPrint, or printing raises "Gantt Chart Not Assigned". Options.PageOrientationusesTPrinterOrientation(fromFMX.Printer), not the PDF orientation type — qualify it asTPrinterOrientation.poLandscape.TaskListColumnsis ignored whenModeisemTimeline.
Related API
TTMSFNCGanttChartPrintIO—GanttChart,GanttChartPrintExportOptions,Options,Print,OnRowIsPageBreak
See also
- Getting started
- PDF IO guides — the same options for PDF export
- Product overview