我需要簡單的代碼點擊按鈕,將我目前的RDLC報告保存爲PDF格式,並會通過savedialog要求用戶將文件保存在所需的位置。我已經到處搜索,找不到任何解決方案。從按鈕點擊生成RDLC的PDF報告
我ShowReport按鈕的代碼是在這裏:
SqlConnection S_Conn = new SqlConnection(strConnString);
S_Conn.Open();
string query_1 = "";
query_1 = "SELECT Record_Id, Select_Ward, Mr_No, Patient_Name, Date_Of_Admission, Date_Of_Dsch_Death, Disease from EO_System_RecordRoomData WHERE Date_Of_Admission = '" + txtbx_DateForReport.Text.Trim() + "'";
SqlCommand Command_1 = new SqlCommand(query_1, S_Conn);
SqlDataAdapter Data_Adapter = new SqlDataAdapter(Command_1);
DataSet1 Data_Set = new DataSet1();
Data_Adapter.Fill(Data_Set);
reportViewer1.LocalReport.DataSources.Clear();
reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", Data_Set.Tables[1]));
this.reportViewer1.RefreshReport();
幫助將得到高度讚賞。
[在後臺從RDLC報告中創建PDF]的可能副本(http://stackoverflow.com/questions/2684221/creating-a-pdf-from-a-rdlc-report-in-the-the-background) –
它不顯示文件將被保存的位置。我想要顯示saveasdialog爲了保存用戶想要的文件。 –