Print([SectionIndex: Integer = -1]; [Direct: Boolean = False]; [ParentWindow: IWin32Window = Null]);
SectionIndex is a parameter that determines index of the section that should be printed. Default value is -1, and the whole document is printed.
Direct is a parameter that indicates whether the window of print settings is displayed. If the parameter is set to True, the window of print settings is not displayed. The printing is done with default settings. If the parameter is set to False, the window of print settings is displayed.
ParentWindow is a window for which this dialog box should be opened modally. By default the ParentWindow is a 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 allows to print only pages of necessary sheet.
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.Print(Direct := True);
End Sub Button1OnClick;
On pressing the button, the regular report connected to the UiReport1 component is printed. The dialog of print setting is not displayed.
See also: