Merajuddin Ansari
Merajuddin Ansari

Reputation: 69

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.

Upvotes: 6

Views: 18545

Answers (5)

Manju
Manju

Reputation: 59

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.

Upvotes: 0

TarekSiala
TarekSiala

Reputation: 36

frmReportViewerX.reportViewer1.LocalReport.DisplayName = "Report Name";

Upvotes: 1

VaibhavGore
VaibhavGore

Reputation: 21

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

Upvotes: 1

Dhavaloo
Dhavaloo

Reputation: 129

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

it's only works with ExportDialog not in PrintDialog.

Upvotes: 12

Atish Singh
Atish Singh

Reputation: 85

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);

Upvotes: -1

Related Questions