c# - Having issue on viewing Excl file generated by SSRS report with cube data source in ASP.net MVC Using view.officeapps.live.com/op/embed.aspx?src=url -
these following requirements.
- there url ssrs report renders report in excel file
- we have setup mvc application web app , webapi app server.
- since ssrs inside firewall app server connect through appserver. in appserver, report has been rendered follows
public httpresponsemessage generatelegacyreport() { try { string endtypestring = "&rs:format=excel"; url = url + businesssegmentformat(businesssegment) + regionstringformat(region) + facilitysitestringformat(selectedsite) + fromdateformat(fromdate) + todateformat(todate) + salespersonformat(username) + sortstringformat(sortorder) + buildsortorderurl(sortbylist) + groupbyformat(reportname, groupby) + endtypestring; //alertmailer setalert = new alertmailer(); //setalert.notifyerror("report", null, url); if (!string.isnullorempty(url)) { string _sessionpipelinereport = "pipelinereport" + datetime.now.tostring("yyyymmddhhmmss") + ".xls"; byte[] excelbytes = null; using (webclient webclient = new webclient()) { webclient.credentials = credentialcache.defaultcredentials; //sample url replaced actual ssrs url url = "https://online.utpb.edu/webapps/dur-browsercheck-bb_bb60/samples/sample.xlsx?crmreports/customerprofilesummary&rs:command=render&businesssegment=%5bbusiness%20segment%5d.%5bbusiness%20segment%20code%5d.%26%5bes%5d®ion=%5bregion%5d.%5bregion%20name%5d.%5ball%5d&facility=%5bfacility%5d.%5bfacility%20name%5d.%5ball%5d&fromdate=%5bearned%20date%5d.%5bdate%5d.%26%5b2015-01-26t00:00:00%5d&todate=%5bearned%20date%5d.%5bdate%5d.%26%5b2016-01-26t00:00:00%5d&user=%5bsalesperson%5d.%5busername%5d.%26%5bapeterson%5d&sortorder=desc&sortby=revenue&rs:format=excel"; excelbytes = webclient.downloaddata(url); } //var result = new httpresponsemessage(httpstatuscode.ok) { content = new bytearraycontent(excelbytes) }; //result.content.headers.contenttype = new mediatypeheadervalue("application/pdf"); //result.content.headers.contentdisposition = new contentdispositionheadervalue("inline") var result = new httpresponsemessage(httpstatuscode.ok) { content = new bytearraycontent(excelbytes) }; result.content.headers.contenttype = new mediatypeheadervalue("application/vnd.ms-excel"); result.content.headers.contentdisposition = new contentdispositionheadervalue("inline") { filename = _sessionpipelinereport }; return result; } return request.createresponse(httpstatuscode.gone); } catch (exception ex) { throw new exception("internal server error. please try again..."); } }
and have start reading web app , render
response.redirect("https://view.officeapps.live.com/op/embed.aspx?src=" +fileurl , false);
we able download report excel file nor rendered int viewer.
please suggest solutions other better online viewer (supports mvc , html 5)
if information sample solution more appreciated :)
Comments
Post a Comment