Share via


Binding to an Embedded Report Class

Object Model

This report binding scenario uses ReportDocument (see Report Binding with ReportDocument Object Model).

Location of Reports

Reports are embedded into the project.

Note

Previous versions of this documentation referred to embedded reports as "strongly-typed." The primary term now used to refer to a report that is added or imported into a Visual Studio project is "embedded."

Description

In this scenario, a report is embedded into the project. To embed a report, you can either create a new report with the embedded Crystal Reports Designer (which is contained within Visual Studio), or import an existing report into the project. When the report is created or imported, a report wrapper class is automatically generated to represent the report. This wrapper class has the same name as the report. It is derived from the base class ReportDocument, and therefore inherits all of the properties and methods of ReportDocument, which makes it part of the ReportDocument object model.

Most users of Crystal Reports for Visual Studio use this scenario for report binding. It is by far the simplest scenario to implement:

  1. Add a report to the project. This automatically generates a report wrapper class.
  2. Instantiate the report wrapper class.
  3. Assign it to the ReportSource property of the CrystalReportViewer control.

Pros

  • Added security: report is embedded and therefore distributed as part of the application.
  • Extensive programmatic interaction: provides access to the powerful ReportDocument object model.
  • Added security: offers the most control over access to report sources.
  • Most commonly used: most developers find that this scenario offers the most advantages.

Cons

  • Added maintenance: changes to reports require recompiling and redistributing the application.

See Also