export local report to csv

  • Thread starter Thread starter BillE
  • Start date Start date
B

BillE

Visual Studio 2008, vb.net, Windows forms application

I have created a report, and I want to export the contents to a csv file.

I can export to Excel or PDF using the ReportViewer save icon.

I can also export to Excel like this:

dim rpt as Byte() = ReportViewer1.LocalReport.Render("EXCEL",Nothing,
Nothing, Nothing, Nothing, Nothing, Nothing)
my.Computer.FileSystem.WriteAllBytes("C:\export.xls", rpt, False)

But if I try to export to a CSV like this:

dim rpt as Byte() = ReportViewer1.LocalReport.Render("CSV",Nothing,
Nothing, Nothing, Nothing, Nothing, Nothing)
my.Computer.FileSystem.WriteAllBytes("C:\export.csv", rpt, False)

I get an error:

"specified argument was out of the range of valid values. parameter name
format"

I read many places which say this should work.

Thanks
Bill
 
Bill,

One of the reasons that creating a report is often difficult, is that it has
no other structure than the mind of the designer.

So I am curious what data you want to use to create that CSV

Is the underlying data not more sufficient for your CSV?

Cor
 
Back
Top