views:

343

answers:

1

I have a formatted table in ReportViewer. When I want to export to Excel though - I do not want to export the formatted table - instead I want to output the original/raw/unmassaged data table in an excel file.

What's the best way to intercept the Export to Excel function and output data in a different format?

+2  A: 

Put the ShowExportButton to False in the ReportViewer and add a new button in your page that do the work.

Or you can get into the ReportExport event, set the Cancel to True, and the fire your custom method.

Private Sub ReportViewer1_ReportExport(ByVal sender As Object, _
           ByVal e As Microsoft.Reporting.WinForms.ReportExportEventArgs) _
           Handles ReportViewer1.ReportExport
    e.Cancel = True
End Sub
Eduardo Molteni
hmm, I guess that's a start... is there anyway I could modify/intercept the Export to Excel command before it gets called?
firedrawndagger
Take a look at the ´ReportExport´ event. I haven't tested it, but it seems to have all what you need.
Eduardo Molteni