问题
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?
回答1:
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
来源:https://stackoverflow.com/questions/2669601/modifying-export-to-excel-in-reportviewer