http://blog.gcpowertools.com.cn/post/2014/08/24/advanced-html-viewer-with-export-options.aspx
这个例子中
- protected void Page_Load(object sender, EventArgs e)
- {
- if (Request["Task"] != null)
- {
- if (Request["Task"].ToString().Contains("Print"))
- {
- rptCustHTML rpt = new rptCustHTML();
- try
- {
- rpt.Run(false);
- }
- catch (Exception eRunReport)
- {
- //If the report fails to run, report the error to the user
- Response.Clear();
- Response.Write("<h1>Error running report:</h1>");
- Response.Write(eRunReport.ToString());
- return;
- }
- //Buffer this page's output until the report output is ready.
- Response.Buffer = true;
-
- //Clear any part of this page that might have already been buffered for output.
- Response.ClearContent();
-
- //Clear any headers that might have already been buffered (such as the content
- //type for an HTML page)
- Response.ClearHeaders();
-
- //Tell the browser and the "network" that the resulting data of this page should
- //be cached since this could be a dynamic report that changes upon each request.
- Response.Cache.SetCacheability(HttpCacheability.NoCache);
-
- //Tell the browser this is an HTML document so it will use an appropriate viewer.
- Response.ContentType = "text/html";
-
- //Create the HTML export object
- GrapeCity.ActiveReports.Export.Html.Section.HtmlExport htmlExport1 = new GrapeCity.ActiveReports.Export.Html.Section.HtmlExport();
-
- //Export the report to HTML in this session's webcache
- MyCustomHtmlOutputter outputter = new MyCustomHtmlOutputter(this.Context);
- htmlExport1.Export(rpt.Document, outputter, "");
- Response.Redirect("ReportOutput" + "/" + System.IO.Path.GetFileName(outputter.mainPage));
- }
- }
- }
复制代码
我看例子里面自己用程序生成了一个SectionReport,那如果是一个现成的带参数的pagereport又怎么处理呢?
还有,可不可以使用前台htmlExport然后进入打印页面?请技术支持的老师帮忙看看 |
|