简体   繁体   中英

How do I set other name instead of default pdf file name in report viewer while exporting it?

i have used report viewer for one of my website page and it's working fine but when i go for export , the exported file name is report4.pdf ,but i don't want that i want to give some other name instead of report4.pdf. how can i do this, Please help.

ReportViewer1.LocalReport.DisplayName = "Your Other Name Goes Here";

它仅适用于 ExportDialog 而不适用于 PrintDialog。

Its Just one line of Code. Thats it. RptViewer.ServerReport.DisplayName = "Your File Name Goes Here";

frmReportViewerX.reportViewer1.LocalReport.DisplayName = "报告名称";

I hope you are using SSRS report.
Export option takes the SSRS file name to create pdf file.
Ex: if you have SSRS file somereport.rdl then when you export the report, pdf file name becomes somereport.pdf

You can change the export file name as follows

    1. Rename the rdl name
    2. Set 'DisplayName' property of the RDL.

Add a button for download and write code to render the report and write to the stream. Something like:

byte[] bytes = ReportViewer1.ServerReport.Render(filetype, null, out mimeType, out encoding, out extension, out streamids, out warnings);
context.Response.BinaryWrite(bytes);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM