locked
Call local server SSRS Export Excel from my Button click RRS feed

  • Question

  • User-1171089525 posted

    Hi All,

    I need to dirctly call ssrs excel report from my  webform Button  click.

    The below code is not working for me

    Dim

    rview As New Microsoft.Reporting.WebForms.ReportViewer()

    rview.LocalReport.ReportPath =

    "Report.rdlc" ' = new Uri(WebConfigurationManager.AppSettings[ReportServer]);

    'rview.ServerReport.ReportServerUrl = new Uri(WebConfigurationManager.AppSettings[ReportServer]);

    'rview.ServerReport.ReportPath = "Report.rdlc"

    Dim mimeType, encoding, extension, deviceInfo As String

    Dim streamids As String()

    Dim warnings As Microsoft.Reporting.WebForms.Warning()

    Dim format As String = "Excel"

    deviceInfo =

    "<DeviceInfo>" & "<SimplePageHeaders>True</SimplePageHeaders>" & "</DeviceInfo>"

    Dim bytes As Byte()

    bytes = rview.LocalReport.Render(format, deviceInfo, mimeType, encoding, extension, streamids, warnings)

    Response.Clear()

    Response.ContentType =

    "application/excel"

    Response.AddHeader(

    "Content-disposition", "filename=output.xls")

    Response.OutputStream.Write(bytes, 0, bytes.Length)

    Response.OutputStream.Flush()

    Response.OutputStream.Close()

    Response.Flush()

    Response.Close()

     

    Please help me out.

    Wednesday, April 3, 2013 4:57 AM

All replies