Table of Contents

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;

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 GanttChart before calling Print, or printing raises "Gantt Chart Not Assigned".
  • Options.PageOrientation uses TPrinterOrientation (from FMX.Printer), not the PDF orientation type — qualify it as TPrinterOrientation.poLandscape.
  • TaskListColumns is ignored when Mode is emTimeline.

See also