Search code examples
rdl

Render Html using RDL Local Report


I need to render html from rdl reports using the LocalReport class, I dont want to use ReportViewer for the same. Is there any way i can enable generating HTML.


Solution

  • As far as I know LocalReport cannot be exported to HTML (only Excel,Word and PDF are available). But if you are still interested in export you can use following

    Dim Report = New LocalReport
    

    prepare report the same way as for viewing (Datasource for RDL reports with ReportViewer)

    Dim warnings As Warning() = Nothing
    Dim streamids As String() = Nothing
    Dim mimeType As String = Nothing
    Dim encoding As String = Nothing
    Dim extension As String = Nothing
    Dim bytes As Byte() = Nothing
    bytes = Report.Render(RenderFormat, Nothing, mimeType, encoding, extension, streamids, warnings)
    Using fs As New IO.FileStream(RepPath, IO.FileMode.Create)
      fs.Write(bytes, 0, bytes.Length)
      fs.Close()
      ReDim bytes(0)
    end Using
    

    You can get list of available extensions with Report.ListRenderingExtensions

    ServerReport solution is similar, but more possible export formats is available.