I am developing one application in asp.net MVC 5.0, for reporting purpose. I am making the use of SSRS Reporting Services. I rendered report in excel format. I make call to reporting services and rendered report in "byte[] array" .then I pass this bytes to return file for download excel file. Below is code I wrriten in action :-
public ActionResult RendertoEXCEL(string Parameter,string reportName)
{
byte[] ReadRequest = null;
JavaScriptSerializer js = new JavaScriptSerializer();
ParameterValue[] parameters = js.Deserialize<ParameterValue[]>(Parameter);
string RptFomrat = "EXCEL";
SSRSReportManager rptManager = new SSRSReportManager(RServiceURL, RptUserName, RptPassword);
ReadRequest = rptManager.RenderReport(RDirName, reportName, RptFomrat, parameters);
return File(ReadRequest, "application/vnd.ms-excel", "Report.xls");
}
and $.get function on button click using jquery
function GetConsExcelFomrat()
{
jQuery.ajaxSettings.traditional = true
var array = @Html.Raw(Json.Encode(@ViewBag.Array as ParameterValue[]));
var arrays=JSON.stringify(array);
var url = '@Url.Action("RendertoEXCEL", "Reports") ?Parameter=' + arrays + '&reportName=' + '@ViewBag.rptName';
$.get(url, function (res)
{
window.location = url
});
}
Excel file is downloading in my browser window but when I am trying to open file It shows error that " Problems during load :-Missing File:C:\Content\CSS\Style.css" I think file cant get css effect. can anybody have solution for this.
Thanks in advance.
