Class
Report
Description
Used to generate reports.
Properties
Name |
Type |
Read-Only |
Shared |
---|---|---|---|
Methods
Name |
Parameters |
Returns |
Shared |
---|---|---|---|
units As Reports Module |
|||
ds As Reports Module, printerSettings As PrinterSetup |
Property descriptions
Report.Document
Document As RBReportDocument
Contains the rendered pages after the Report is Run.
This example runs a Report to obtain the rendered pages in a DataSet:
Var ds As New GasDataSet
Var ps As New PrinterSetup
Var rpt As New GasPricesReport
If rpt.Run(ds, ps) Then
If rpt.Document <> Nil Then ReportViewer1.SetDocument(rpt.Document)
End If
Method descriptions
Report.Constructor
Constructor(units as Reports Module)
Note
Constructors are special methods called when you create an object with the New keyword and pass in the parameters above.
Creates a new Report in the passed unit. The default is Reports Module.Units.Pixels.
Report.Run
Run(ds As Reports Module, printerSettings As PrinterSetup) As Boolean
Generates a Report document from the given RowSet. This eliminates the need to first convert a RowSet to a Report.
Running a Report to obtain the rendered pages in a DataSet:
Var rpt As New ListOfProducts
Var rs As RowSet = ordersDB.SelectSQL(sql)
Var ps As New PrinterSetup
If rpt.Run(rs, ps) Then
If rpt.Document <> Nil Then
ShowReport(rpt.Document)
End If
End If
This generates and prints a Report:
Var rpt As New MyReport // A report in the project
Var ps As New PrinterSetup
Var g As Graphics
g = ps.ShowPrinterDialog(Nil)
If g <> Nil Then
If Not rpt.Run(data, ps) Then // data is the report data
rpt.Document.Print(g)
Else
MessageBox("There was an error generating the report.")
End If
End If
This generates and prints multiple copies of a Report:
Var rpt As New MyReport // A report in the project
Var ps As New PrinterSetup
Var g As Graphics
g = ps.ShowPrinterDialog(Nil)
Var readyToPrint As Boolean = True
If g <> Nil Then
For copies As Integer = 1 To 2 // Number of copies
If Not rpt.Run(data, ps) Then // data is the report data
readyToPrint = False
End If
Next
// Print the results
If readyToPrint Then
rpt.Document.Print(g)
Else
MessageBox("There was an error generating the report.")
End If
End If
Sample code
Running a Report to obtain the rendered pages in Reports Module:
Var ds As New GasDataSet
Var ps As New PrinterSetup
Var rpt As New GasPricesReport
If rpt.Run(ds, ps) Then
If rpt.Document <> Nil Then ReportViewer1.SetDocument(rpt.Document)
End If
Compatibility
All project types on all supported operating systems.
See also
Object parent class; Reports Module module; RBReportDocument, ReportField, ReportLabel, ReportLineShape, ReportOvalShape, ReportRectangleShape, ReportRoundRetangleShape. ReportPicture classes.