How To…Show the Outline in a TppViewer

Question

“How do I display the report outline used with the preview window in a TppViewer object on a form?”

Solution

This can be done by manually creating a TppReportOutline object and placing it inside a TPanel on the form. Simply create the outline object, set its Parent to the TPanel and assign its Viewer property to the TppViewer component also on the form.

The following example shows how this should be done.

Download: AddOultineToTppViewer.zip

Sample Delphi code:

procedure TForm1.CreateOutline;
begin

  FOutlineViewer := TppOutlineViewer.Create(nil);
  FOutlineViewer.Parent := Panel1;
  FOutlineViewer.Color := clltGray;
  FOutlineViewer.Align := alClient;
  FOutlineViewer.Viewer := ppViewer1;
  FOutlineViewer.OutlineVisible := True;

end;