I can help with the export, not sure how to print - and I only have a C# example:
EXPORT TO EXCEL OR PDF
There is a button on the report allowing the user to export to excel or pdf. However, if you want to force an export using code, just add this code:
private void exportToExcel(string DestWhereExcelFileWillBe)
{
System.IO.FileInfo fi = new System.IO.FileInfo(DestWhereExcelFileWillBe);
if (fi.Exists) fi.Delete();
Warning[] warnings;
string[] streamids;
string mimeType, encoding, filenameExtension;
byte[] bytes = reportViewer1.LocalReport.Render( "Excel", null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
System.IO.FileStream fs = System.IO.File.Create(DestWhereExcelFileWillBe);
fs.Write(bytes, 0, bytes.Length);
fs.Close();
}
or VB.Net Code Example Here
The code I use to Generate a single report as a PDF is:
Dim warnings As Microsoft.Reporting.WebForms.Warning() = Nothing
Dim streamids As String() = Nothing
Dim mimeType As String = Nothing
Dim encoding As String = Nothing
Dim extension As String = Nothing
Dim deviceInfo As String
Dim bytes As Byte()
Dim lr As New Microsoft.Reporting.WebForms.LocalReport
deviceInfo = "<deviceinfo><simplepageheaders>True</simplepageheaders></deviceinfo>"
bytes = ReportViewer1.LocalReport.Render("PDF", deviceInfo, mimeType, encoding, extension, streamids, warnings)
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.BinaryWrite(bytes)
Response.Flush()
Response.Close()
[Edit by MK]
Solution Source