ActiveReports 17 .NET Edition
Developers / Export Reports / Export Page/RDL Reports / HTML Export
In This Topic
    HTML Export
    In This Topic

    HTML, or hypertext markup language, is a format that opens in a Web browser. You can export your reports to HTML or MHT formats. It is a good format for delivering content because virtually all users have an HTML browser. The HTMLRenderingExtension renders your report in this format with improved table border rendering and high-quality SVG output for charts. If you do not want to use SVG in charts, set the RenderingEngine property to Html.

    HTML Rendering Properties

    ActiveReports offers several options to control how reports render to HTML.

    Property Description
    Fragment Determine whether or not the full HTML text will be returned or just the contents contained inside the body tag will be returned. True indicates only the content inside the body tag will be returned. The default is false.
    MhtOutput Gets or sets whether or not the output should be in Mht format. True indicates the output should be in Mht format; otherwise, false. The default is false.
    RenderingEngine The RenderingEngine property is set to Mixed by default for improved quality output. The choices are Html or Mixed, where Mixed uses SVG to render charts.
    StyleStream Set the StyleStream to True to create an external .css file containing style information from your report controls' style properties. If you prefer to have style information embedded in the HTML file, set the StyleStream property to False.
    LinkTarget Specify a link target to control whether drill-down reports and other links open in a new window or reuse the current window. By default, no value is set and links open in the same window. A value of _blank opens the link in a new window, or you can specify a window using window_name. By default, this value is not set.
    Mode Galley mode renders the report in one HTML stream. Select Paginated mode to render each page as a section inside the HTML document.
    OutputTOC Indicates whether the report's existing TOC should be added to the output.


    Reports rendered in HTML support a number of interactive features. Hyperlinks, Bookmarks, and Drill through links can be rendered to HTML. However, Document Maps are not available in this format. For a drill-down report, make sure that the data you want to display is expanded before rendering, otherwise, it renders in the hidden state.


    Export Report using HTML Rendering Extension

    The following steps provide an example of rendering a report in HTML format.   

    1. Create a new or open an existing Visual Studio project.
    2. If you are creating a new project, select ActiveReports 17 Page report Application in Create a New Project dialog, specify a name for the project, and click OK.
      If you are using an existing project, in the Solution Explorer, right-click the project and select Add > New Item. Select ActiveReports 17 Page report and click Add. By default, a Page report is added to the project.
    3. Add a reference to GrapeCity.ActiveReports.Export.Html package in the project.    
    4. On the Form.cs or Form.vb that opens, double-click the high-quality title bar to create the Form_Load event.
    5. Add the following code inside the Form_Load event.
    Visual Basic.NET code. Paste INSIDE the Form Load event.
    Copy Code
    ' Provide the Page report you want to render.
    Dim rptPath As New IO.FileInfo("..\..\PageReport1.rdlx")
    Dim pageReport As New GrapeCity.ActiveReports.PageReport(rptPath)
    ' Create an output directory.
    Dim outputDirectory As New System.IO.DirectoryInfo("C:\MyHTML")
    ' Provide settings for your rendering output.
    Dim htmlSetting As New GrapeCity.ActiveReports.Export.Html.Page.Settings()
    Dim setting As GrapeCity.ActiveReports.Extensibility.Rendering.ISettings = htmlSetting
    ' Set the rendering extension and render the report.
    Dim htmlRenderingExtension As New GrapeCity.ActiveReports.Export.Html.Page.HtmlRenderingExtension()
    Dim outputProvider As New GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name))
    ' Overwrite output file if it already exists.
    outputProvider.OverwriteOutputFile = True
    pageReport.Document.Render(htmlRenderingExtension, outputProvider, htmlSetting)
    C# code. Paste INSIDE the Form Load event.
    Copy Code
    // Provide the Page report you want to render. 
    System.IO.FileInfo rptPath = new System.IO.FileInfo(@"..\..\PageReport1.rdlx");
    GrapeCity.ActiveReports.PageReport pageReport = new GrapeCity.ActiveReports.PageReport(rptPath);
    // Create an output directory.
    System.IO.DirectoryInfo outputDirectory = new System.IO.DirectoryInfo(@"C:\MyHTML");
    // Provide settings for your rendering output.
    GrapeCity.ActiveReports.Export.Html.Page.Settings htmlSetting = new GrapeCity.ActiveReports.Export.Html.Page.Settings();
    GrapeCity.ActiveReports.Extensibility.Rendering.ISettings setting = htmlSetting;
    // Set the rendering extension and render the report.
    GrapeCity.ActiveReports.Export.Html.Page.HtmlRenderingExtension htmlRenderingExtension = new GrapeCity.ActiveReports.Export.Html.Page.HtmlRenderingExtension();
    GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider outputProvider = new GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name));
    // Overwrite output file if it already exists.
    outputProvider.OverwriteOutputFile = true; 
    pageReport.Document.Render(htmlRenderingExtension, outputProvider, htmlSetting);