Print([SectionIndex: Integer = -1]; [Direct: Boolean = False]; [ParentWindow: IWin32Window = Null]);
SectionIndex - parameter that determines index of the section that should be printed. Default value is -1, and the whole document is printed.
Direct - parameter that determines whether the window of print options is displayed. If the parameter is set to True, the window of print options is not displayed. The printing is made with default options. If the parameter is set to False, the window of print options is displayed.
ParentWindow - window, for which this dialog box opens modally. By default, ParentWindow is the current form.
The Print method prints the document in accordance with the set parameters.
The SectionIndex parameter is relevant only for regular reports. If the parameter is not specified, the whole regular report is printed when the method is called. If the SectionIndex parameter is set, it prints only pages of necessary sheet.
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.Print(Direct := True);
End Sub Button1OnClick;
On pressing the button, the regular report connected to the UiReport1 component is printed. The dialog box of print setup does not open.
See also: