如何使RDLC为PDF在IE和Opera [英] How to render RDLC to PDF in IE and Opera

查看:237
本文介绍了如何使RDLC为PDF在IE和Opera的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题似乎是一个重复的问题,但我在这里有一个奇怪的问题。我们有渲染RDLC报告,有一些参数将在code设置,然后附加到报告,并将其呈现为PDF格式PDF的Web应用程序。
我有这个code背后:

My question seems a duplicate question but I have an strange issue here. We have a web application that render RDLC reports to PDF format that has some parameter that will be set in code then append to the report and render it to PDF. I have this code behind:

LocalReport rep = new LocalReport();
        rep.ReportPath = "ReimbursementClaimForm.rdlc";
        List<ReportParameter> param = new List<ReportParameter>();
        param.Add(new ReportParameter("NameofthePatient", txtNameofthePatient.Text));
        param.Add(new ReportParameter("MBASIDNo", txtMBASIDNo.Text));
        param.Add(new ReportParameter("DateofBirth", string.Format("{0:dd MMMM, yyyy}", Convert.ToDateTime(txtDateofBirth.Text))));
        param.Add(new ReportParameter("CompleteHomeAddress", txtCompleteHomeAddress.Text));
        param.Add(new ReportParameter("EmailAddress", txtEmailAddress.Text));
        param.Add(new ReportParameter("ContactNos", txtContactNos.Text));
        param.Add(new ReportParameter("ExpenseClaim", txtExpenseClaim.Text));
        param.Add(new ReportParameter("AccountHolderName", txtAccountHolderName.Text));
        param.Add(new ReportParameter("AccountHolderName2", txtAccountHolderName2.Text));
        param.Add(new ReportParameter("AccountNoandAccountType", txtAccountNoandAccountType.Text));
        param.Add(new ReportParameter("BankName", txtBankName.Text));
        param.Add(new ReportParameter("BankBranch", txtBankBranch.Text));
        param.Add(new ReportParameter("BankContactNo", txtBankContactNo.Text));
        param.Add(new ReportParameter("BankAddress", txtBankAddress.Text));
        param.Add(new ReportParameter("BICSwiftCode", txtBICSwiftCode.Text));
        param.Add(new ReportParameter("RTGSCode", txtRTGSCode.Text));
        param.Add(new ReportParameter("IBAN", txtIBAN.Text));
rep.SetParameters(param);
        rep.DisplayName = "ReimbursementClaimForm";
        rep.Refresh();
HttpContext.Current.Response.Buffer = true;
        //HttpContext.Current.Response.Clear();
        HttpContext.Current.Response.AppendHeader("content-disposition", "attachement filename=" + Rep.DisplayName + ".pdf");
        HttpContext.Current.Response.ContentType = "application/PDF";
Warning[] warnings;
            string[] streamids;
            string mimeType;
            string encoding;
            string extension;
            byte[] bytes = item.Render("Pdf", null, out mimeType, out encoding, out extension, out streamids, out warnings);
        HttpContext.Current.Response.BinaryWrite(bytes);
        HttpContext.Current.Response.Flush();
        HttpContext.Current.Response.End();

这里的问题是,每当我使用部署对从文本框的ASP的值设置ReportParameter这code值的应用程序不会反映在生成的PDF文件。在呈现的第一次尝试值,但在第二次,值未更新上的PDF。这发生在IE浏览器和Opera浏览器,但在其他浏览器的罚款,并记一旦Web应用程序部署在IIS,但我的本地机器上它工作在所有浏览器的罚款。先谢谢了。

The problem here is that whenever I deploy the app using this code values on the ReportParameter that are set from the values of textboxes on ASP are not reflected in the generated PDF file. At first try values rendered but on the second time around values not updated on the PDF. This happens on IE and Opera browsers but on other browsers its fine and take note once the web app was deployed on IIS but on my local machine it works fine in all browsers. Thanks in advance.

推荐答案

最有可能缓存问题。
加入此行,只是在你的Response.Clear()

Most probably caching issues. Add this line to just over your Response.Clear()

HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);

清除浏览器缓存,然后重试。

Clear your browser cache and try again

这篇关于如何使RDLC为PDF在IE和Opera的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆