Hello,
I am exporting reports in pdf format from .net 2005 . The export is working fine; however the user values of stored procedure parameters does not show in the report. What do I need to do in order to see the parameters value in the report?
The report has a report parameter "reportTitle" and i see the value in the report.
It has also another 2 stored procedure parameters @BeginDate and @EndDate.
The values are entered be the user; however in the report those values don't appear.
I used the following code:
[HTML]
//load the report
crReportDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocum ent();
crReportDocument.Load(Server.MapPath("\Reports\Pro duction.rpt") ;
// set logins for the crystal report
Utilities.SetLogons(crReportDocument);
Hashtable reportParamsHash = ((Hashtable)Session["ReportParamsHash"]);
foreach (String keyParamName in reportParamsHash.Keys)
{
Utilities.SetParam(crReportDocument, keyParamName, reportParamsHash[keyParamName].ToString());
}
// export report
Utilities.ExportToPDF(crReportDocument, Server.MapPath(fileName));
// function that sets report parameters values
public static void SetParam( ReportDocument crReportDocument, string ParamName, object ParamValue)
{
//set the parameter value
crReportDocument.SetParameterValue(ParamName, ParamValue);
}
// function to export the report
public static void ExportToPDF(ReportDocument Report, string file)
{ ExportToDisk(Report, file, ExportFormatType.PortableDocFormat);
}
private static void ExportToDisk(ReportDocument Report, string fileName,ExportFormatType expFormat)
{
DiskFileDestinationOptions diskOpts = ExportOptions.CreateDiskFileDestinationOptions();
ExportOptions exportOpts = new ExportOptions();
exportOpts.ExportFormatType = expFormat;
exportOpts.ExportDestinationType = ExportDestinationType.DiskFile ;
diskOpts.DiskFileName = fileName;
exportOpts.ExportDestinationOptions = diskOpts;
Report.Export(exportOpts);
}
[/HTML]
Can anybody help?
Thank you,
Mariana