报告打印 [英] Reports print

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

问题描述

大家好!
我有一个问题,每个人都需要帮助.
我想打印三份类似的报告.我试了又试,但是只检查了一次.我有以下代码:

hello everyone!
I have a problem everyone needs help.
I want to print a similar report three times. I tried and tried but it just check in once. I have the following code:

 private void button1_Click (object sender, EventArgs e)
        {
            try
            {
                / / Loadreport ("select * from CodeHanghoa");
                string [] = {noidung "Save your company", "delivery to the customer", "...................." };
                ParameterFields paramFields;

                ParameterField paramField;
                ParameterDiscreteValue paramDiscreteValue;

                / / ReportDocument = new ReportDocument ();


                DataSet ds = Loadreport ("select * from CodeHanghoa");
                for (int i = 0; i <3; i)
                {
                    ParameterFields paramFields = new ();

                    ParameterField paramField = new ();
                    CrystalReport1 CrystalReport1 rep = new ();
                    rep.Load ("CrystalReport1.rpt");

                    paramField.Name = "var11";
                    ParameterDiscreteValue paramDiscreteValue = new ();
                    paramDiscreteValue.Value = "Lien" (i 1) ":" noidung [i];
                    paramField.CurrentValues.Add (paramDiscreteValue);
                    / / Add the paramField to paramFields
                    paramFields.Add (paramField);
                    crystalReportViewer1.ParameterFieldInfo = paramFields;
                    rep.SetDataSource (ds);
                    crystalReportViewer1.ReportSource = rep;
                }
            }
}
catch
{

}



在Advance中致谢



Thanks in Advance

推荐答案

您未打印,正在显示报告.您还只需要重新分配ReportViewer.ReportSource三次,每次都覆盖之前的分配,而该分配没有完成.
You are not printing, you are displaying the report. You are also only reassigning the ReportViewer.ReportSource three times, each time overwriting the previous assignment which accomplished nothing.


您完全错了,正如Mark所说的,要打印多个副本,请调用PrintToPrinter方法.在代码中添加以下行
You are totally wrong as Mark said, For printing multiple copies call the PrintToPrinter method. Add the below line in your code
//public virtual void PrintToPrinter (int nCopies, bool collated, int startPageN, int endPageN);

rep.PrintToPrinter(3, False, 0, 0);



注意:从代码中删除循环,或仅将其用于参数块.



Note : Remove the Loop from your coding or make it only for your parameter block.


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

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