ActiveReports 10
Rendering to HTML
ActiveReports 10 > ActiveReports User Guide > Concepts > Exporting > Rendering Extensions > Rendering to HTML

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. You can use the HTMLRenderingExtension to render your report in this format.

In order to render your report in HTML, add reference to the following assemblies in the project:

Note: Rendering to HTML requires the .NET Framework full profile version. To ensure you are using the full profile version, go to the Visual Studio Project menu > Properties > Compile tab > Advanced Compile Options (for Visual Basic projects) or to the Project menu > Properties > Application tab (for C# projects) and under Target framework select a full profile version.

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

  1. In Visual Studio, create a new Windows Forms Application or open an existing one.
  2. On the Form.cs or Form.vb that opens, double-click the title bar to create the Form_Load event.
  3. 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 report As New GrapeCity.ActiveReports.PageReport(New System.IO.FileInfo("C:\Sample_PageReport.rdlx"))
    Dim reportDocument As New GrapeCity.ActiveReports.Document.PageDocument(report)
    
    ' Create a directory
    Dim outputDirectory As New System.IO.DirectoryInfo("C:\MyHTML")
    outputDirectory.Create()
    
    ' 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))
    reportDocument.Render(htmlRenderingExtension, outputProvider, htmlSetting)
    
    C# code. Paste INSIDE the Form Load event.
    Copy Code
    // Provide the page report you want to render.
    GrapeCity.ActiveReports.PageReport report = new GrapeCity.ActiveReports.PageReport(new System.IO.FileInfo(@"C:\Sample_PageReport.rdlx"));
    GrapeCity.ActiveReports.Document.PageDocument reportDocument = new GrapeCity.ActiveReports.Document.PageDocument(report);
    
    // Create a directory
    System.IO.DirectoryInfo outputDirectory = new System.IO.DirectoryInfo(@"C:\MyHTML");
    outputDirectory.Create();
    
    // 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));
    reportDocument.Render(htmlRenderingExtension, outputProvider, htmlSetting);
    

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 return; otherwise false. 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.
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.
JavaScript Gets or sets whether or not JavaScript will be included in the html. True indicates JaveScript will be used; otherwise false. The default is true.
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.
Output TOC Indicates whether the report's existing TOC should be added in the output.

Limitations

Interactivity

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.

See Also

Concepts