lincstech
asked on
programming render and save reportviewer
Hello,
I'm looking to find a solution on how to programming render a report viewer document and save the document as a PDF. So far I've established this small line of code however, I'm sure there is more to it that I am missing.
I'm looking to find a solution on how to programming render a report viewer document and save the document as a PDF. So far I've established this small line of code however, I'm sure there is more to it that I am missing.
ReportViewer1.LocalReport.Render
String reportFormat = "PDF";
FileStream stream = null;
String filePath = "";
String mimeType;
String encoding;
String fileNameExtension;
Microsoft.Reporting.WebForms.Warning[] warnings;
String[] streamIds;
//Render the report into a byte arrary, then save this byte arrary to a file
byte[] reportBytes = ReportViewer1.ServerReport.Render(reportFormat, null, out mimeType, out encoding, out fileNameExtension, out streamIds, out warnings);
filePath = Server.MapPath("ReportFolder") + "/" + "MyPDFReport" + "." + fileNameExtension;
stream = new System.IO.FileStream(filePath, System.IO.FileMode.Create);
stream.Write(reportBytes, 0, reportBytes.Length);
ASKER
Is this a Visual Basic.net code or C Sharpe coding ? I'm looking for VB.net
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Here is a code snippet for this :
String reportFormat = "PDF";
FileStream stream = null;
String filePath = "";
String mimeType;
String encoding;
String fileNameExtension;
Microsoft.Reporting.WebFor
String[] streamIds;
//Render the report into a byte arrary, then save this byte arrary to a file
byte[] reportBytes = ReportViewer1.ServerReport
filePath = Server.MapPath("ReportFold
stream = new System.IO.FileStream(fileP
stream.Write(reportBytes, 0, reportBytes.Length);