January 5, 2024 at 10:24 pm
Hello,
I am using the ReportViewer.aspx page to display a SSRS Report. When exporting the report to any format(CSV,PDF,Excel, etc.) it uses the ReportViewerControl.exportReport function which has the following code:
window.open(this.ExportUrlBase+encodeURIComponent(n),"_blank")
What I would like to do is stop a new window/tab from being created, so instead of "_blank", "_self" could be used. Any idea on how I can change this?
Thanks for any help that I can get.
January 6, 2024 at 11:10 pm
Thanks for posting your issue and hopefully someone will answer soon.
This is an automated bump to increase visibility of your question.
January 10, 2024 at 9:08 pm
My opinion - I wouldn't make changes to the core SSRS files. My reasoning - you make all your changes and make things work exactly how you want and everyone is happy. Then a year goes by, you install the latest SP and it blows out your changes. Do you really want to maintain your customizations like that every time you do an update?
Also, having a link open a new page in "_self" will mean that any time a user goes to export the report, they will (likely) lose the report page which is probably not a desired effect.
Now, maybe I am misunderstanding what you are doing and if I go with my other interpretation of what you are doing, you are using something like .NET to call out to SSRS to download stuff and don't want a new window being generated when you try to export the results. If this the case, then writing the URL to download is a better way which is mentioned on this site:
https://stackoverflow.com/questions/54990825/connect-ssrs-to-web-api
As the SSRS 2017 web API doesn't allow you to export, but they provide the hint that by having your URI like this:
{SSRS URL} / reportserver / {path} ?rs:Format=PDF
It will generate things so you can download the PDF directly without needing to have someone click on the "export" button.
IF this is a .NET (or similar) application, then to download you just need to change the URI to end with "Format=<export format>" where <export format> is the format you want to export in (CSV, PDF, Excel, etc.).
The above is all just my opinion on what you should do.
As with all advice you find on a random internet forum - you shouldn't blindly follow it. Always test on a test server to see if there is negative side effects before making changes to live!
I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply