Need Export Dialog to come up
Hi all, I am using VS 2003 and Crystal Reports XI. I'm having a problem getting the export dialog box to come up. What I need is when the user clicks the "Export" button, they get the prompts that you would normally get when you export from the Report Viewer. But I don't want to use the report viewer. The following code exports the report but I need to have the dialog boxes that prompt the user for the file type and location. Any help is greatly appreciated.
private void btnExport_Click(object sender, System.EventArgs e)
{
string exportFileName="exportedReport.pdf";
string exportPath="\\Crystal" + "\\" + exportFileName;
string fileName=("rptBankTotals.rpt");
string filePath=String.Concat(@\\Server\Folder + "\\" + fileName);
System.Data.SqlClient.SqlParameter[] par = new System.Data.SqlClient.SqlParameter[2];
int size = 0;
par[size] = new System.Data.SqlClient.SqlParameter("EndingDate", SqlDbType.DateTime);
par[size].Value = this.udtDate.Value;
size++;
par[size] = new System.Data.SqlClient.SqlParameter("FinancialAccou ntId", SqlDbType.Int);
par[size].Value =Convert.ToInt32(ucbSelectBank.Value);
size++;
DataSet ds = objReports.RunReport("usp_rptBankTotals", par);
ReportDocument crReportDocument=new ReportDocument();
crReportDocument.Load (filePath);
crReportDocument.SetDataSource(ds);
crReportDocument.ExportToDisk(ExportFormatType.Por tableDocFormat,exportPath);
Thank you!!
|