问题描述
您好,我有一个C#应用程序,我希望能够让用户导出报告,但避免使用报告查看器。我可以将报告导出,但仅当我提供文件名和导出路径等时。我希望用户能够命名文件并选择保存位置。这是我的代码。非常感谢任何帮助!!
Hello, I have a C# application and I want to be able to have the user export a report but avoid the Report Viewer. I can get the report to export but only if I supply the file name and export path etc. I want the user to be able to name the file and select where to save it. Here is my code. Any help is GREATLY appreciated!!
string exportFileName =" exportedReport.pdf" ;
string exportFileName="exportedReport.pdf";
string exportPath =" \\Crystal" +"\\" + exportFileName;
string exportPath="\\Crystal" + "\\" + exportFileName;
string fileName =(" rptBankTotals.rpt");
string fileName=("rptBankTotals.rpt");
string filePath = String.Concat(@" \\\ \\ flsouth2 \DAP_Initial_Deploy\Reports" +" \\" + fileName);
string filePath=String.Concat(@"\\flsouth2\DAP_Initial_Deploy\Reports" + "\\" + fileName);
System.Data.SqlClient.SqlParameter [] par = new System.Data.SqlClient .SqlParameter [2];
System.Data.SqlClient.SqlParameter[] par = new System.Data.SqlClient.SqlParameter[2];
int size = 0;
int size = 0;
par [size] = new System.Data.SqlClient.SqlParameter(" EndingDate" ;,SqlDbType.DateTime);
par[size] = new System.Data.SqlClient.SqlParameter("EndingDate", SqlDbType.DateTime);
par [size] .Value = this.udtDate.Value;
par[size].Value = this.udtDate.Value;
size ++;
par [size] = new System.Data.SqlClient.SqlParameter(" FinancialAccountId",SqlDbType.Int);
par[size] = new System.Data.SqlClient.SqlParameter("FinancialAccountId", SqlDbType.Int);
par [size] .Value = Convert.ToInt32 (ucbSelectBank.Value);
par[size].Value =Convert.ToInt32(ucbSelectBank.Value);
size ++;
DataSet ds = objReports.RunReport(" usp_rptBankTotals",par);
DataSet ds = objReports.RunReport("usp_rptBankTotals", par);
ReportDocument crReportDocument = new ReportDocument();
ReportDocument crReportDocument=new ReportDocument();
crReportDocument.Load(filePath);
crReportDocument.Load (filePath);
crReportDocument.SetDataSource(ds);
crReportDocument.SetDataSource(ds);
crReportDocum ent.ExportToDisk(ExportFormatType.PortableDocFormat,exportPath);
crReportDocument.ExportToDisk(ExportFormatType.PortableDocFormat,exportPath);
推荐答案
Don
这篇关于C#Crystal XI-Export对话框不会出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!