IE8中打印冷却液报告中的问题 [英] problem in printing of cryatal report in IE8

查看:71
本文介绍了IE8中打印冷却液报告中的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用VS2005和IE8,现在在IE8中打印水晶报表时遇到问题.
请给我解决方案.问题是..当我单击打印"选项时,一个水晶报表查看器窗口出现,并且正在加载几分钟.但是没有输出,只是正在加载..

编辑-[从注释部分移开了OP的代码. ]

I am using VS2005 and IE8, now I have a problem in printing of crystal report in IE8.
please give me the solution. The problem is ..when i clicked on print option a crystal report viewer window came and it was loading for several minutes. But no output came just loading was going on..

Edit - [ Moved OP''s code from comment section. ]

CrystalDecisions.CrystalReports.Engine.Tables tables = rpt.Database.Tables; 
foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables) 
{ 
CrystalDecisions.Shared.TableLogOnInfo tableLogOnInfo = table.LogOnInfo; 
tableLogOnInfo.ConnectionInfo.ServerName = ConfigurationManager.AppSettings["CrystalServer"]; tableLogOnInfo.ConnectionInfo.DatabaseName = ConfigurationManager.AppSettings["DatabaseName"]; tableLogOnInfo.ConnectionInfo.UserID = ConfigurationManager.AppSettings["CrystalUser"]; tableLogOnInfo.ConnectionInfo.Password = ConfigurationManager.AppSettings["CrystalPassword"]; table.ApplyLogOnInfo(tableLogOnInfo); } rpt.Refresh(); CrystalReportViewer1.ReportSource = rpt;

推荐答案



如果有帮助,请参阅此编码...

示例:

在后面的代码中:
Hi,

See this coding if could help...

Example:

In code behind:
 using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using System.Data;
using XP.Tools;

public partial class Report1 : System.Web.UI.Page
{
    #region "Declaration Report Document and DataSet"
    ReportDocument crpt = new ReportDocument();
    string rptLoc = String.Empty;
    // Assumed Dataset1 has already created in App_Code with its fields
    DataSet1 ds = new DataSet1();
    #endregion

    #region "Methods for Adding a parameters"
    private void AddParameter(ReportDocument reportDocument, string value, string parameterName)
    {
        ParameterFieldDefinitions prmDef = reportDocument.DataDefinition.ParameterFields;
        ParameterValues prmVal = new ParameterValues();
        ParameterDiscreteValue prmDiscreteVal = new ParameterDiscreteValue();
        prmDiscreteVal.Value = value;
        prmVal.Add(prmDiscreteVal);
        ParameterFieldDefinition prmFD = prmDef[parameterName];
        try
        {
            prmFD.ApplyCurrentValues(prmVal);
            prmFD.ApplyDefaultValues(prmVal);
        }
        catch (Exception)
        {
            Response.Redirect("~\\Login.aspx");
        }
    }
    #endregion

    protected void Page_Load(object sender, EventArgs e)
    {
        CrystalReportViewer1.ReportSourceID = "CrystalReportSource1";
        CrystalReportSource1.Report.FileName = Server.MapPath("") + "\\CReport\\ClaimStatementIP.rpt";
        rptLoc = CrystalReportSource1.Report.FileName;
        crpt.Load(rptLoc);
        crpt.SetDataSource(ds);
        AddParameter(crpt, "Client Card Number", "CardNumber");
        AddParameter(crpt, "Client Policy Number", "PolicyOwner");
        DataTable dt = new DataTable();
        dt = GetBenefits();  // Get Benefits from database table 
        ds.dtCPT.Clear();
        if (dt.Rows.Count > 0)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow row;
                row = ds.dtCPT.NewRow();
                row["Description"] = dt.Rows[i]["Description"];
                row["ActualCharges"] = dt.Rows[i]["ActualCharges"];
                ds.dtCPT.Rows.Add(row);  // the name of table in DataSet1 is 'dtCPT'
            }
            CrystalReportViewer1.ReportSource = crpt;
        }

    }

    private DataTable GetBenefits()
    {
        DataTable dt = new DataTable();
        // Some code to retieve records here from database
        // ....
        return dt;
    }
}




希望这可以帮助...

问候




Hope this could help...

Regards,


这篇关于IE8中打印冷却液报告中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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