This the demo how to download the ssrs report in Core asp.net.
Export.cshtml:- in this
page copy in page the code
@{
ViewData["Title"] = "Export";
}
<h1>Export</h1>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<script>
var app =
angular.module('DemoApp', []);
app.controller('DemoController', function ($scope,
$window) {
$scope.export = function () {
var path
= "https://localhost:44342/Home/ExportReport?id=1";
$window.location.href = path
}
});
</script>
<div ng-app="DemoApp" ng-controller="DemoController">
<a style="cursor:pointer;color:blue" ng-click="export()">Export
Report</a>
</div>
Controller Page:-
ServerName
:- change the
name with your server name where you put your Report.
ProjectName:-
Change the name with your project name.
ReportName:-
change with your report name that you give.
public IActionResult Export()
{
return View();
}
public ActionResult
ExportReport(string id)
{
string reportserver
= "http://ServerName";
string url = string.Format("{0}/ReportServer/Pages/ReportViewer.aspx?/ProjectName/ReportName&rs:Command=Render&rs:Format=EXCELOPENXML&rc:
id={1}", reportserver, id);
return Redirect(url);
}