dan henderson
asked on
specify report name when saving as pdf file
when saving a report created with ssrs as a pdf file, is there any way to specify the name of the pdf file?
ASKER
yes, that's what I'm doing at the moment. This is a web application. When the user saves the report as a pdf, I want to supply a name programmatically .
ASKER
BTW, I'm NOT using the control, just the report web url.
If you are using the ReportViewer control, you can set the DisplayName property.
YourReportView.LocalReport.DisplayName = "YourName"
ASKER
I am not using the ReportViewer control. This is strictly web delivery.
Ok, there is answer in Expert Exchange about save pdf report.
https://www.experts-exchange.com/questions/27581973/Programmatically-export-an-SSRS-report-to-pdf-file.html
Can you set your file name of pdf report while you write file with FileStream ?
https://www.experts-exchange.com/questions/27581973/Programmatically-export-an-SSRS-report-to-pdf-file.html
Can you set your file name of pdf report while you write file with FileStream ?
FileStream stream = File.OpenWrite("D:\\YourFileName.pdf");
ASKER
I have not tried that ... currently I use the download button on the report to download a pdf file. How would I use a filestream object instead of this? Here is the code on my view:
The URL for the report is passed in the ViewBag, which uses the "&rs:embed=true" parameter to view on cshtml page.
<h2>Patrol Monthly Summary</h2>
<br /><br />
<div>
<iframe src="@ViewBag.Url" width="900" height="900"></iframe>
</div>
The URL for the report is passed in the ViewBag, which uses the "&rs:embed=true" parameter to view on cshtml page.
You can not change file name from the client side (HTML or javascript). You need to change it from the server.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I was trying to pre-set the file name, since using "save as" seems a bit to complex for my client ;)
ASKER
guess that's the only way to do it. thanks.
You can click
Run or Preview the report, then click Export on the ribbon, select PDF fromat and the Save As dialog will open. By default, the file name is that of the report that you exported. Optionally, you can change the file name.