执行“serverreport.render”以打印 PDF 格式的报告后,交互式排序在网页上不起作用。
下面是我的代码。
private void Print()
{
HttpContext cont = HttpContext.Current;
HttpResponse myRes = cont.Response;
System.Web.SessionState.HttpSessionState mySess = cont.Session;
string enCoding = null;
string strNull = null;
string strPDF = "PDF";
enCoding = Request.Headers["Accept-Encoding"];
string mimeType = "application/pdf";
string extension = ".pdf";
string[] streamids = null;
Warning[] warnings = null;
byte[] mybytes = null;
mybytes = ReportViewer1.ServerReport.Render(strPDF, strNull, out mimeType,
out enCoding, out extension, out streamids, out warnings);
myRes.Buffer = true;
myRes.Clear();
myRes.ContentType = "application/pdf";
myRes.AddHeader("Content-disposition", "filename=output.pdf");
myRes.BinaryWrite(mybytes);
myRes.Flush();
myRes.End();
}
显然,将报告呈现为 PDF 会使事情变得混乱。
欢迎所有建议。
谢谢
大卫