Export to HTML/MHTML fails when using SSRS local report viewer control

SoftwareUser 41 Reputation points
2022-01-08T14:23:13.48+00:00

We are using the local Report Viewer control in SSRS v14 to render a report to HTML/MHTML using the Render method on the Microsoft.Reporting.WebForms.LocalReport object.

We also tried exporting to MHTML format (see https://learn.microsoft.com/en-us/sql/reporting-services/mhtml-device-information-settings?view=sql-server-ver15) but this failed with the error "Specified argument was out of the range of valid values.". Below is the DeviceInfo used for the Render method:

Dim deviceInfo As String = "<DeviceInfo>" &
"<OutputFormat>MHTML</OutputFormat>" &
"JavaScript" & False & "</JavaScript>" &
"<OutlookCompat>" & True & "</OutlookCompat>" &
"<DataVisualizationFitSizing>" & "Approximate" & "</DataVisualizationFitSizing>" &
"</DeviceInfo>"

Are HTML/MHTML export formats supported with the local Report Viewer control and, if so, does anyone have a solution to this problem? We are looking for a supported and documented API, not a hack or workaround. Thank you in advance.

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
3,061 questions
0 comments No comments
{count} votes

Accepted answer
  1. Joyzhao-MSFT 15,631 Reputation points
    2022-01-10T03:19:35.75+00:00

    Hi @SoftwareUser ,
    Unlike the Report Server the ReportViewer control does not connect to databases or execute queries. Also, in local mode the only export formats available are Excel, Word and PDF. (In remote mode all formats supported by the Report Server are available.) The ReportViewer control cannot be extended by adding custom renderers or custom report items.
    If you want to export reports to HTML/MHTML in native mode ReportViewer, you can consider using Aspose.Words for Reporting Services.
    Best Regards,
    Joy


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.