PrintPreview([SectionIndex: Integer = -1;] [ParentWindow: IWin32Window = Null;] [ViewByPage: Boolean = False]);
SectionIndex is a parameter that determines index of the section for which the preview should be called. Default value is -1, and preview window is displayed for the active section of the document.
ParentWindow is a window for which this preview window is opened modally. By default the ParentWindow is a current form.
ViewByPage is a parameter that determines preview mode. If it is set to True, the current page is previewed, other pages are loaded as pages are turned over. If it is set to False, the whole document is loaded for preview. It is relevant to use it when there is a great number of pages to speed up opening of the preview window.
The PrintPreview method previews the document before printing.
The SectionIndex parameter is relevant only for regular reports. If the parameter is not specified, the preview of the active sheet of the regular report is called when the method is called. If the SectionIndex parameter is specified, it allows to call the preview of necessary sheet.
Comments. It is possible to switch sheets in the preview window.
Executing the example requires a form, a button named Button1 positioned on it, the DocumentPrinter component named DocumentPrinter1 and the UiReport component named UiReport1. Any regular report is connected to the UiReport1.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Begin
UiReport1.Active := True;
DocumentPrinter1.Source := UiReport1 As IDocumentSource;
DocumentPrinter1.PrintPreview(0);
End Sub Button1OnClick;
On pressing the button, the preview window is displayed on the screen for the first sheet of the regular report connected to the UiReport1 component.
See also: