IDocumentPrinter.PrintPreview

Syntax

PrintPreview([SectionIndex: Integer = -1;] [ParentWindow: IWin32Window = Null;] [ViewByPage: Boolean = False]);

Parameters

SectionIndex - parameter that determines index of the section, for which the preview must be called. Default value is -1, and preview window opens for the active section of the document.

ParentWindow - window, for which this preview window opens modally. By default, ParentWindow is the current form.

ViewByPage - 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.

Description

The PrintPreview method previews the document before printing.

Comments

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 calls the preview of necessary sheet.

NOTE. It is possible to switch sheets in the preview window.

Example

Executing the example requires a form, a button named Button1 on it, the DocumentPrinter component named DocumentPrinter1 and the UiReport component named UiReport1. Any regular report is connected to 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 opens for the first sheet of the regular report connected to the UiReport1 component.

See also:

IDocumentPrinter