Creating a Custom Export to Excel for ReportViewer (rdlc)

后端 未结 3 1862
庸人自扰
庸人自扰 2020-12-14 08:46

I\'m interested in creating a custom Export to Excel option for my Report in ReportViewer. This is mostly because I want pdf disalbed and I did that via:

 Re         


        
3条回答
  •  悲哀的现实
    2020-12-14 09:18

    Just a heads up... the accepted answer will render as an XLS file, which was requested by the original poster.

    However, you can now export to XLSX as well. You have to change the format parameter of the Render() method from "Excel" to "EXCELOPENXML".

    To get a full list of possible values you can call ReportViewer1.LocalReport.ListRenderingExtensions(). When I ran it on my report viewer instance I got these possible options:

    "Excel" "EXCELOPENXML" "IMAGE" "PDF" "WORD" "WORDOPENXML"

    I found it very hard to determine what you needed to pass in for the formats. MSDN documents this very poorly if you ask me.

提交回复
热议问题