Report Builder Export to CSV with colum header spaces

僤鯓⒐⒋嵵緔 提交于 2019-12-01 20:29:02

Yes It is possible to export to CSV with the spaces in column header. Here's how I achieved it.

Step 1
Update your report dataset to include the headers on row 1.

SELECT * FROM
(
 SELECT Field1, Field2, 2 as rowOrder
  FROM Tables
  Where Conditions
 UNION ALL
 SELECT 'Activity Date' AS Field1, 'Expiry Date' AS Field2, 1 as rowOrder
) ORDER BY rowOrder

Step 2:
Modify the RSReportServer.config file on Report server to customize CSV export to exclude header.

2012 config file Location: C:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportServer

2008 File Location: \Program Files\Microsoft SQL Server\MSSQL.n\Reporting Services\ReportServer

Imp: Make a backup of the RSReportServer.config in case you need to rollback your changes.

Add another entry in <render> section below CSV extension.

<Extension name="CSVNoHeader" Type="Microsoft.ReportingServices.Rendering.DataRenderer.CsvReport,Microsoft.ReportingServices.DataRendering">
    <OverrideNames>
        <Name Language="en-US">CSV No Header</Name>
    </OverrideNames>
    <Configuration>
        <DeviceInfo>
            <NoHeader>true</NoHeader>
        </DeviceInfo>
     </Configuration>
</Extension>

Save it. Now you have another drop down export option CSV No Header along with CSV, PDF, XML. Users can use this option to extract the data in CSV with the spaces in the header.

MSDN Link to customize Rendering extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!