Introduction:
SQL Server Reporting Services (SSRS) support BMP, EMF, EMFPlus, GIF, JPEG, PNG, and TIFF image formats. While we can only see TIFF as the available image format in the Render format drop down list on the report server. In this article, I will tell you how to export a report to other supported image formats with some specified pages.
Solution:
Generally, we can specify the OutputFormat DeviceInfo settings () in the RSReportServer.config file, then it will add the specified format to the drop-down list. Add the following code to rsreportserver.config under Configuration/Extensions/Render to modify
the default settings of the Image rendering extension:
<Extension Name="IMAGE (JPEG)" Type="Microsoft.ReportingServices.Rendering.ImageRenderer.ImageRenderer,Microsoft.ReportingServices.ImageRendering"> <OverrideNames> <Name Language="en-US"> Image (JPEG)</Name> </OverrideNames> <Configuration> <DeviceInfo> <OutputFormat> JPEG</OutputFormat> </DeviceInfo> </Configuration> </Extension>
The settings above is applied to SSRS2012 and 2008 R2, if we use it for 2008 and 2005, we need use Microsoft.ReportingServices.Rendering.ImageRenderer.ImageReport to replace Microsoft.ReportingServices.Rendering.ImageRenderer.ImageRenderer in the settings.
Alternatively, we can directly use the URL Access below with OutputFormat Device Information Settings for the IMAGE rendering extension to render the report to other format images.
http://localhost/ReportServer?/Reportfolder/myreport&rs:format=IMAGE&rc:OutputFormat=JPEG
Besides, TIFF is the only format that supports multiple pages in a single file in SSRS. When we export a report to IMAGE with Outputformat= TIFF, the Report Server will export the report to one image file with all pages. However, if we export with other Outputformats, it will only export the first page.
In this scenario, we can specify the startpage and endpage in the URL as below to export report with specified pages.
http://localhost/ReportServer?/Reportfolder/myreport&rs:format=IMAGE&rc:OutputFormat=JPEG&rc:startpage=1&rc:endpage=1
Because TIFF is the only format that supports multiple pages in a single file in SSRS, so there are two scenario:
- Outputformat= TIFF:
If the endpage is bigger than or equal to the startpage, it will export the specified page from startpage to endpage as myreport.tif.
If the startpage is bigger than the endpage, it will export only one specified page (startpage) to an image file as myreport.tif. - Other Outputformats, such as Outputformat= JPEG:
It export a report with only one specified page (startpage) to an image file as myreport_startpage.jpeg. So we can specify only the startpage in the URL when export a report to other image formats.
By the way, all of the above apply to JPEG format also applies to BMP, EMF, EMFPlus, GIF and PNG formats.
References:
Exporting to an Image File (Report Builder and SSRS)
Customize Rendering Extension Parameters in RSReportServer.Config
Applies to:
Reporting Services 2005
Reporting Services 2008
Reporting Services 2008 R2
Reporting Services 2012
- Edited by Elvis LongMicrosoft contingent staff, Moderator 3 hours 2 minutes ago edit