Class

# Report

<div class="rst-class">

forsearch

</div>

Reporting

<div class="rst-class">

forsearch

</div>

Printing

<div class="rst-class">

forsearch

</div>

Print

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Used to generate reports.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                            | Type                                               | Read-Only | Shared |
|---------------------------------|----------------------------------------------------|-----------|--------|
| `DataSource<report.datasource>` | `Reports.Dataset</api/printing/reporting/dataset>` |           |        |
| `Footer<report.footer>`         | RBReportSection                                    |           |        |
| `FooterTop<report.footertop>`   | `Integer</api/data_types/integer>`                 | ✓         |        |
| `Group<report.group>`           | RBReportGroup                                      |           |        |
| `Header<report.header>`         | RBReportSection                                    |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                              | Parameters                                                                                                              | Returns                                                      | Shared |
|-----------------------------------|-------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------|--------|
| `AddFooter<report.addfooter>`     | sectionToAdd As RBReportSection                                                                                         |                                                              |        |
| `AddGroup<report.addgroup>`       | groupToAdd As RBReportGroup                                                                                             |                                                              |        |
| `AddHeader<report.addheader>`     | sectionToAdd As RBReportSection                                                                                         |                                                              |        |
| `Close<report.close>`             |                                                                                                                         |                                                              |        |
| `Constructor<report.constructor>` | defaultunits As `Reports.Units<reports.units>` = `Reports.Units.Pixels<reports.units>`                                  |                                                              |        |
| `Document<report.document>`       |                                                                                                                         | `RBReportDocument</api/printing/reporting/rbreportdocument>` |        |
| `Run<report.run>`                 | ds As `Reports.Dataset</api/printing/reporting/dataset>`, pdf As `PDFDocument</api/pdf/pdfdocument>`                    | `Boolean</api/data_types/boolean>`                           |        |
|                                   | ds As `Reports.Dataset</api/printing/reporting/dataset>`, printersettings As `PrinterSetup</api/printing/printersetup>` | `Boolean</api/data_types/boolean>`                           |        |
|                                   | rs As `RowSet</api/databases/rowset>`, pdf As `PDFDocument</api/pdf/pdfdocument>`                                       | `Boolean</api/data_types/boolean>`                           |        |
|                                   | rs As `RowSet</api/databases/rowset>`, printerSettings As `PrinterSetup</api/printing/printersetup>`                    | `Boolean</api/data_types/boolean>`                           |        |
| `Units<report.units>`             |                                                                                                                         | `Reports.Units<reports.units>`                               |        |

## Property descriptions

<div id="report.datasource">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Report.DataSource

**DataSource** As `Reports.Dataset</api/printing/reporting/dataset>`

> The source of the data for the report.

<div id="report.footer">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Report.Footer

**Footer** As RBReportSection

> The section at the bottom of each page of a report.

<div id="report.footertop">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Report.FooterTop

**FooterTop** As `Integer</api/data_types/integer>`

> The vertical location on the page of the top of the footer.
>
> This property is read-only.

<div id="report.group">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Report.Group

**Group** As RBReportGroup

> The last Group added to the <span class="title-ref">report</span> via the `AddGroup<report.addgroup>` method.

<div id="report.header">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Report.Header

**Header** As RBReportSection

> The section at the top of each page of a report.

## Method descriptions

<div id="report.addfooter">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Report.AddFooter

**AddFooter**(sectionToAdd As RBReportSection)

> Adds the passed footer to the report.

<div id="report.addgroup">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Report.AddGroup

**AddGroup**(groupToAdd As RBReportGroup)

> Adds the passed group to the report.

<div id="report.addheader">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Report.AddHeader

**AddHeader**(sectionToAdd As RBReportSection)

> Adds the passed header to the report.

<div id="report.close">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Report.Close

**Close**

> Sets all <span class="title-ref">Report</span> controls to `Nil</api/language/nil>`.

<div id="report.constructor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Report.Constructor

**Constructor**(defaultUnits As `Reports.Units<reports.units>` = `Reports.Units.Pixels<reports.units>`)

> Creates a new <span class="title-ref">Report</span> in the passed unit. The default is `Reports.Units.Pixels<reports.units>`.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> `Constructors</api/language/constructor>` are special methods called when you create an Object With the `New</api/language/New>` keyword And pass In the parameters above.
>
> </div>

<div id="report.document">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Report.Document

**Document** As `RBReportDocument</api/printing/reporting/rbreportdocument>`

> Returns the rendered pages after the <span class="title-ref">Report</span> is Run.
>
> The document returned is the object you print to render the <span class="title-ref">report</span> to `PDF</api/pdf/pdfdocument>` or the printer.
>
> This example runs a <span class="title-ref">Report</span> to obtain the rendered pages in a `Dataset</api/printing/reporting/dataset>`:
>
> ``` xojo
> 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
> ```

<div id="report.run">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Report.Run

**Run**(ds As `Reports.Dataset</api/printing/reporting/dataset>`, pdf As `PDFDocument</api/pdf/pdfdocument>`) As `Boolean</api/data_types/boolean>`

> Creates the <span class="title-ref">report</span> as a `PDFDocument</api/pdf/pdfdocument>` using the `Reports.Dataset</api/printing/reporting/dataset>` passed.
>
> This eliminates the need to first convert a `Dataset</api/printing/reporting/dataset>` to a `Report</api/printing/reporting/report>`.

<div id="report.run1">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Report.Run

**Run**(ds As `Reports.Dataset</api/printing/reporting/dataset>`, printerSettings As `PrinterSetup</api/printing/printersetup>`) As `Boolean</api/data_types/boolean>`

> Creates the <span class="title-ref">report</span> using the `Reports.Dataset</api/printing/reporting/dataset>` passed.
>
> This eliminates the need to first convert a `Dataset</api/printing/reporting/dataset>` to a `Report</api/printing/reporting/report>`.

<div id="report.run2">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Report.Run

**Run**(rs As `RowSet</api/databases/rowset>`, pdf As `PDFDocument</api/pdf/pdfdocument>`) As `Boolean</api/data_types/boolean>`

> Creates the <span class="title-ref">report</span> as a `PDFDocument</api/pdf/pdfdocument>` using the `RowSet</api/databases/rowset>` passed.
>
> This eliminates the need to first convert a `RowSet</api/databases/rowset>` to a `Report</api/printing/reporting/report>`.

<div id="report.run3">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Report.Run

**Run**(rs As `RowSet</api/databases/rowset>`, printerSettings As `PrinterSetup</api/printing/printersetup>`) As `Boolean</api/data_types/boolean>`

> Creates the <span class="title-ref">report</span> using the `RowSet</api/databases/rowset>` passed.
>
> This eliminates the need to first convert a `RowSet</api/databases/rowset>` to a `Report</api/printing/reporting/report>`.

<div id="report.units">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

Report.Units

**Units** As `Reports.Units<reports.units>`

> Returns the unit of measure for the report.

## Sample code

This example runs a <span class="title-ref">Report</span> to obtain the rendered pages in a `Dataset</api/printing/reporting/dataset>`:

``` xojo
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 example generates and prints a \`Report\`:

``` xojo
Var rpt As New MyReport ' A report in the project
Var ps As New PrinterSetup               
Var g As Graphics = 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 example generates and prints multiple copies of a \`Report\`:

``` xojo
Var rpt As New MyReport ' A report in the project
Var ps As New PrinterSetup               
Var g As Graphics = 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
```

## Compatibility

|                       |         |
|-----------------------|---------|
| **Project Types**     | Desktop |
| **Operating Systems** | All     |

<div class="seealso">

RBReport parent class; `Reports Module</api/printing/reporting/reports_module>` module; `RBReportDocument</api/printing/reporting/rbreportdocument>`, `ReportField</api/printing/reporting/reportfield>`, `ReportLabel</api/printing/reporting/reportlabel>`, `ReportLineShape</api/printing/reporting/reportlineshape>`, `ReportOvalShape</api/printing/reporting/reportovalshape>`, `ReportRectangleShape</api/printing/reporting/reportrectangleshape>`, `ReportRoundRetangleShape</api/printing/reporting/reportroundrectangleshape>`. `ReportPicture</api/printing/reporting/reportpicture>` classes.

</div>
