Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Blank lines at end of SSRS CSV Export

When exporting information from SQL Server Reporting Services in CSV format, it always appends two blank lines after the last row of data in the exported file.

Whilst I can edit the file after the export and remove the blank lines, is it possible to prevent SSRS from producing the two blank lines in the first place?

like image 313
Pervez Choudhury Avatar asked Nov 04 '10 10:11

Pervez Choudhury


2 Answers

See the following connect article (and vote for it to be fixed!

Bug 557655 SSRS2008 - Extra blank line in csv files created by csv renderer on export of report.

You need to alter the rendering extenstion setting for csv export in the RSReportServer.config file. Set the Device Info setting for CSV for ExcelMode to false like this:

    <Render>
        <Extension Name="XML" Type="Microsoft.ReportingServices.Rendering.DataRenderer.XmlDataReport,Microsoft.ReportingServices.DataRendering"/>
        <Extension Name="NULL" Type="Microsoft.ReportingServices.Rendering.NullRenderer.NullReport,Microsoft.ReportingServices.NullRendering" Visible="false"/>
        <Extension Name="CSV" Type="Microsoft.ReportingServices.Rendering.DataRenderer.CsvReport,Microsoft.ReportingServices.DataRendering">
            <Configuration>
                <DeviceInfo>
                    <ExcelMode>False</ExcelMode>
                </DeviceInfo>
            </Configuration>                
        </Extension>

The default for the Excel mode setting is true. There is a known bug in the Excel Mode CSV renderer that adds an extra blank line. This workaround will allow you to get around the error. I had to implement this when I moved from SSRS 2005 to SSRS 2008.

like image 82
William Salzman Avatar answered Oct 16 '22 07:10

William Salzman


Newer versions of SSRS allow you to specify various settings in your report URL query string. To have bottom lines removed just add &rc:ExcelMode=false. More information here.

like image 45
Martin Avatar answered Oct 16 '22 06:10

Martin