1527150 - How to Export to read only Crystal Reports Format (*.rptr) format using the Crystal Reports .NET SDK

SAP Knowledge Base Article - Public

1527150 - How to Export to read only Crystal Reports Format (*.rptr) format using the Crystal Reports .NET SDK

Symptom

How to export a report to the new read only Crystal Reports format (.RPTR) using the CR .NET SDK.

Environment

  • Visual Studio 2010
  • Crystal Reports for Visual Studio 2010

Resolution

C# Code sample:

private void SaveAsRPTR_Click(object sender, EventArgs e)
{
 CrystalDecisions.Shared.DiskFileDestinationOptions diskOpts = CrystalDecisions.Shared.ExportOptions.CreateDiskFileDestinationOptions();
 CrystalDecisions.Shared.ExportOptions exportOpts = new CrystalDecisions.Shared.ExportOptions();
 exportOpts.ExportDestinationOptions = diskOpts;
 diskOpts.DiskFileName = "c:\\reports1.rptr";
 exportOpts.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile;
 exportOpts.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.RPTR;
 MyReportObject.Export(exportOpts);
 MessageBox.Show("Export to RPTR Complete", "RAS", MessageBoxButtons.OK, MessageBoxIcon.Information);
}

Or, use this one line to do the same:

MyReportObject.ExportToDisk(ExportFormatType.RPTR, "c:\\report1.rptr");

See Also

Note: the Developers help file indicates these are your options in code when using RPTR reports:

SAP Crystal Reports Read-Only (RPTR) reports are Crystal reports that can be viewed with report viewer applications, but cannot be modified with the SDK or opened by report designer applications. This lets you protect your intellectual property by preventing users from modifying the report or obtaining information about proprietary business logic stored in the report definition.
SAP Crystal Reports Read-Only format reports use the RPTR file extension instead of the RPT file extension used by Crystal reports. You can create an RPTR report by exporting an RPT report to RPTR format. However, there is no supported way to convert an RPTR report to an RPT report.
Because the definition of an RPTR report cannot be modified, you cannot use this SDK to set the data source location of an RPTR report through the database controller. However, you can refresh the data of an RPTR report at run time.

You can use this SDK to perform the following tasks:
• Create an RPTR report by exporting a Crystal report (RPT) to RPTR format.
• View an RPTR report by obtaining its report source and passing the report source to a viewer.
• Refresh the data of an RPTR report at run time.
• Open an RPTR report, and export it to formats other than RPT.


You cannot use this SDK to perform the following tasks:
• Modify the report definition of an RPTR report.
• Set the data source location of the report.
• Retrieve information about the report definition of an RPTR report, including the formulas, fields, sections, and objects that make up the report.
• Export an RPTR report to RPT format.
• Add an RPTR report as a subreport to an RPT report.

 

Keywords

rptr, VS2010, CRVS2010, Crystal Reports for Visual Studio 2010, Visual Studio .NET 2010 , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To

Product

SAP Crystal Reports, developer version for Microsoft Visual Studio