export local report to csv

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
 
C

Cor Ligthert[MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top