Modifying Export to Excel in ReportViewer

随声附和 提交于 2019-12-11 07:28:32

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!