Friday, February 20, 2009

Exporting to a text file from Reporting Services

(Personal Reference)

A client recently asked me how one could add an export to text file in Reporting Services. I won’t go through the business reasons for this but this is how I suggested they go about it.

Add the following text:

<Extension Name="TXT" Type="Microsoft.ReportingServices.Rendering.CsvRenderer.CsvReport,Microsoft.ReportingServices.CsvRendering">
    <OverrideNames>
        <Name Language="en-US">TXT (Pipe Delimited Text File)</Name>
    </OverrideNames>
    <Configuration>
        <DeviceInfo>
            <FieldDelimiter>|</FieldDelimiter>
            <Extension>TXT</Extension>
            <Encoding>ASCII</Encoding>
        <NoHeader>true</NoHeader>
        </DeviceInfo>
    </Configuration>
</Extension>

to the SSRS config file, rsreportserver.config, usually located in:

C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer. The text will need to be included with the other renders in that file between the render tags.

Happy Deving!

7 comments:

Rosdi said...

Hi, do you know whether this could work in MS Reporting Server 2008 Express?

I can see a lot of extensions in rsreportserver.config but they dont seems to be enabled.. only Word, Excel, and PDF works out of the box.

Unknown said...

I have done this one . But it is aded the TXT in my drop down . But when I am trying to save it is saving as .CSV format

Stuart French said...

Hi all. This didn't work for me and led to a merry chase to find out why. Finally discovered this page with the solution.

Turns out if you change CSVRenderer to DataRenderer in the header it works fine.

http://sql-ution.com/adding-pipe-delimited-option-for-report-rendering/

Colin Kirkby said...

Hi Stuart,
Thanks for your response. This blog post was written in early 2009 (as you can see by the date) and I was using SQL 2008. This ("Microsoft.ReportingServices.Rendering.CsvRenderer.CsvReport")is what the header looked like in SSRS 2008. I am gathering things have changed for 2008 R2 onwards. Unfortunately one can not always go back and update every piece of code for each new version. Thanks for the update though.

Unknown said...

Hi Colin,

Was wondering if you can help me. I follow your instruction on where to insert the code, and also changing the name from CSVRenderer to DataRenderer and CSVRendering to DataRendering, and it works. But, when exporting this, even though I put extension txt, it still exporting this to .csv. Any idea why? Or is there any additional thing i need to do to make it export straight as .txt? Thanks in advance.

Isham

Unknown said...
This comment has been removed by the author.
Unknown said...

Turns out, i found the solution to my original answer, and hope it will help someone else in the future.

Instead of using Extension, use FileExtension.

When using Extension, it still ask to be exported to .csv rather than .txt. Good luck.