Hi
Does somebody knows how to save a remote report on the webserver when the report is generated in a report viewer, all programmaticaly behind the scenes?
So I can view the report later.
Thx
There various approaches to this. Personally I would present the user with some UI for selecting which report they wish to view and submit this to the server using a HTML form. On the server side, check if the requested report exists (depending on how often you wish to recreate the report), if yes then redirect the user to the report, if not then you will need to make a call to the ReportService.Render method requesting HTML as the output format, write the html file to the server and then redirect the user to the newly generated file.
Obviously there are other considerations such as data security, parameters etc.... to consider.
|||Thx
I have found a solution for the problem by using the Render method as you suggested.
On my localhost it works fine. Only thing to check is if it works on the internet as well.
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string extension;
string deviceInfo;
deviceInfo = "<DeviceInfo><SimplePageHeaders>True</SimplePageHeaders></DeviceInfo>";
byte[] bytes = rptAfdruk.ServerReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings);
string sPath = Server.MapPath("/timesheet");
FileStream fs = new FileStream(sPath + "/docs/" + sRegId + "/" + sName + ".pdf", FileMode.Create);
fs.Write(bytes, 0, bytes.Length);
fs.Close();
No comments:
Post a Comment