1

I'm trying to get my local SQL Server 2005 Reporting Services RDLC file to render its raw data into CSV format - unsucessfully :-( I have an ASP.NET 4.0 app and I'm trying to just export the raw data into CSV.

I can render my reports into PDF or Excel (XLS) just fine - works like a charm.

But when I try to render the data into a CSV format using this line of code:

byte[] bytes = _reportViewer.LocalReport.Render(renderType);

// renderType is set to "CSV", _reportViewer is my local ReportViewer instance

instead of getting my CSV file to be downloaded, I get this exception:

System.ArgumentOutOfRangeException
Message: The argument is outside of its valid range. Parameter name: format

at Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, CreateAndRegisterStream createStreamCallback, Warning[]& warnings)
at Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
at Microsoft.Reporting.WebForms.LocalReport.Render(String format, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
at Microsoft.Reporting.WebForms.Report.Render(String format, String deviceInfo, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
at Microsoft.Reporting.WebForms.Report.Render(String format, String deviceInfo)
at Microsoft.Reporting.WebForms.Report.Render(String format)
at MyCode.reports.ReportBasePage.RenderReport(String renderType, String contentType, String extension)

I do have the CSV renderer configured in my local RSReportServer.config file:

<Extensions>
   <Render>
      <Extension Name="CSV"
                 Type="Microsoft.ReportingServices.Rendering.DataRenderer.CsvReport,
                       Microsoft.ReportingServices.DataRendering" />

along with a whole slew of other rendering extensions.....

I'm a bit at a loss right now - any ideas? Can't seem to find any hints in any documentation or blog post so far :-( (most say you need to register the CSV rendering extensions - but that's already in place for me!)

Charles
  • 50,943
  • 13
  • 104
  • 142
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • If all else fails and you *really, really* need this, the reverse of [this answer](http://stackoverflow.com/a/13057837/419956) *may* work for you: backport the 2008 renderer to your 2005 instance. – Jeroen Feb 12 '13 at 13:06

0 Answers0