Blank lines at end of SSRS CSV Export
When exporting information from SQL Server Reporting Services in CSV format, it always 开发者_JAVA百科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?
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.
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.
精彩评论