Hi:
I tried this code based on Don's suggestions:
ReportDocument rptDoc = new ReportDocument(); | |
rptDoc.Load(reportName); | |
ConnectionInfo connectionInfo = CreateConnectionInfo(); | |
SetDbLogonForReport(connectionInfo, rptDoc); | |
CrystalDecisions.ReportAppServer.ReportDefModel.TextExportFormatOptions txtFmtOpts = | |
new TextExportFormatOptions(); | |
CrystalDecisions.ReportAppServer.ReportDefModel.ExportOptions exportOpts1 = new CrystalDecisions.ReportAppServer.ReportDefModel.ExportOptions(); | |
exportOpts1.ExportFormatType = CrReportExportFormatEnum.crReportExportFormatReportDef; | |
exportOpts1.FormatOptions = txtFmtOpts; | |
exportOpts1.UseDefault = true; |
//exportOpts1.FormatOptions = RastxtExpOpts; | |
rptDoc.SetParameterValue(0, "C"); | |
rptDoc.ReportClientDocument.PrintOutputController.ExportEx(exportOpts1).Save(reportName.Replace(".rpt", ".txt"), true); |
and it returns:
System.Runtime.InteropServices.COMException (0x80004005): Not a supported export type.
at CrystalDecisions.ReportAppServer.Controllers.PrintOutputControllerClass.ExportEx(ExportOptions exportOptions)
SetdbLogonForReport uses some code I found on this site to set the connection info and CreateConnectionInfo simply creates a ConnectionInfo object with all info needed to connect to an Oracle database.
One other thing I thought is why does the report API have to run the report to export the report definition?
I also checked the other site and the sample from Dell simply uses the object model to get information from the report.
One of the things I've done previously, before posting this thread on the forum, was to export the report document DataDefinition property to json. While it was useful for finding used fields and so on, I wanted to find the API that exports the report exactly in the same way as the CR Designer report definition export works.
But maybe it is not possible.
I am using CR 13 SP 14 SDK.