Posted on: 7/13/2015 3:22:43 PM | Views : 861

In my ASP.NET Web Form project that has the following code behind the page to export a ReportViewer Local Report to an excel document: private void CreateDoc(string fileName, string fileType) { // Variables Warning[] warnings; string[] streamIds; string mimeType = string.Empty; string encoding = string.Empty; string extension = string.Empty; byte[] bytes = rvEquipInven.LocalReport.Render(fileType, null, out mimeType, out encoding, out extension, out streamIds, out warnings); // Now that you have all the bytes representing the PDF report, buffer it and send it to the client. Response.Buffer = true; Response.Clear(); Response.ContentType = mimeType; Response.AddHeader("content-disposition", "attachment; filename=" + fileName + "." + extension); Response.BinaryWrite(bytes); // create the file Response.Flush(); // send it to the client to download
Go to the complete details ...