void ExportToPDF() { Warning[] warnings; string[] streamIds; string mimeType = string.Empty; string encoding = string.Empty; string extension = string.Empty; string Shdate = dateTimePicker1.Value.ToString("M-dd-yyyy"); string Shift = comboBox1.Text.ToString(); ReportParameterCollection reportParameters = new ReportParameterCollection(); reportParameters.Add(new ReportParameter("ReportParameter1", comboBox1.Text)); reportParameters.Add(new ReportParameter("RPSHIFT", dateTimePicker1.Text)); //lets export now ReportViewer viewer = new ReportViewer(); viewer.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local; ; viewer.LocalReport.ReportEmbeddedResource = "Report1.rdlc"; //This is your rdlc name. viewer.LocalReport.SetParameters(reportParameters); viewer.LocalReport.Refresh(); byte[] bytes = viewer.LocalReport.Render( "PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings); Fname = "Buffer Production Report-"+ Shift+"-"+ Shdate; FFname = "\\knltoacdb1\\share\\ED\\BufferProductionReports\\PDF\\"+Fname+".PDF"; using (FileStream fs = new FileStream( FFname, FileMode.Create)) { fs.Write(bytes, 0, bytes.Length); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)