循环打印Crystal Report [英] Printing Crystal Report in loop

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

问题描述

我的要求是在水晶报告中单击一下,生成/打印特定班级的所有学生的标记表。



当我使用For循环时然后它只显示报告的最后一条记录/页。



AND我的代码是

My requirement is to generate/print mark-sheet of all student of a particular class at a single click, in crystal report.

WHEN I USED For loop then it shows only the last record/page of the report.

AND My code is

  private void btnGenerate_Click(object sender, EventArgs e) {

    try
    {
        axCrystalActiveXReportViewer1.ReportSource = null;

        ReportDocument cryRpt = new ReportDocument();
        TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
        TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
        ConnectionInfo crConnectionInfo = new ConnectionInfo();
        Tables CrTables;


        crConnectionInfo.ServerName = Configuration.ServerName;
        crConnectionInfo.DatabaseName = Configuration.DataBaseName;
        crConnectionInfo.UserID = Configuration.Server_userName;
        crConnectionInfo.Password = Configuration.Server_password;



        CrTables = cryRpt.Database.Tables;
        foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
        {
            crtableLogoninfo = CrTable.LogOnInfo;
            crtableLogoninfo.ConnectionInfo = crConnectionInfo;
            CrTable.ApplyLogOnInfo(crtableLogoninfo);
        }

       for(int i=0; i<=x; i++)
        {
            DataSet ds_ViewTermMarkSheet = new DataSet();
            Hashtable htViewTermMarkSheet = new Hashtable();

            htViewTermMarkSheet.Add("@Year", txtYear.Text);
            htViewTermMarkSheet.Add("@Faculty", cboFaculty.Text);
            htViewTermMarkSheet.Add("@Level", cboClass.Text);
            htViewTermMarkSheet.Add("@Section", cboSection.Text);
            htViewTermMarkSheet.Add("@term", cboTerm.Text);
            htViewTermMarkSheet.Add("@CRN",.ToString());

            DbOperations _dbAccess = new DbOperations();
            _dbAccess.selectStoredProcedure(ds_ViewTermMarkSheet, "spSelectExamView_Exam_TermWiseMarkSheet", htViewTermMarkSheet, "Marks");





        cryRpt.SetDataSource(ds_ViewTermMarkSheet.Tables["Marks"]);
       }



            axCrystalActiveXReportViewer1.Refresh();


        cryRpt.Close();

    }
    catch (Exception ex)
    {
        MessageBox.Show("Mark Sheet generation was not successful.\r" + ex.Message, "Error!");
    }
}





如何一次附加多个标记并立即打印出来??



how can i append multiple marksheet at once and print them at once??

推荐答案

多年前我尝试使用Crystal Reports for(C ++)输出。我对在运行时简单地更改值的各种障碍感到沮丧。



我使用了.NET 2Dimensional图形例程,从未回头看过Crystal Reports。



最后,你可以在每个页面上随意写任何你想要的东西。您的代码中没有任何限制和数据处理以您自己的设计熟悉的方式。



如果您不熟悉它们,当然有,学习曲线。显然,一旦你可以布局一个页面,你可以用它来布置任意数量的副本,你的符号值会改变。



你应该参加这个方向,我发现使用10x10英寸矩阵很有用(如果你在系统上使用不同的单位,则会有所不同)。我允许我创建/填写表单的技巧是在表单顶部打印矩阵,并简单计算距离边距的打印单位数(我的是1/100,约0.24 mm)。放下表格作为背景,然后在适当的位置打印数据。



奖励:这些相同的方法适用于屏幕上的应用程序设计,允许一些非常有吸引力的UI使用.NET的原生能力(用户系统没有尴尬的推测要求。



Crystal Reports aficionados 将可能会让你通过这个,但考虑这个选项并使用它。简单的原始力量。
Many years ago I tried to use Crystal Reports for (C++) output. I was frustrated with various obstacles to simply changing values at runtime.

I resorted to the .NET 2Dimensional graphics routines and never looked back to Crystal Reports.

Ultimately, you can simply write whatever you want where-ever you want on each page. No restrictions and data handling is done within your code in terms familiar to you by your own design.

If you've not familiar with them, there is, of course, a learning curve. Clearly, once you can lay out a page, you can use that to lay out any number of copies with the values of your symbols changed.

Should you go in this direction, I found it useful to use a 10x10 inch matrix (different if you use different units on your system). My trick, which allows me to create/fill out forms is to print the matrix on top of the form and simply count the number of printing units for the distance from the margins (mine are 1/100", ca. 0.24 mm.). Lay down the form as your background and then print data in appropriate locations.

Bonus: these same methods work for application design on the screen, allowing some very attractive UI's using .NET's "native" abilities (no awkward presumptions requirements of user systems.

Crystal Reports aficionados will probably get you through this, but consider this option and play with it. Simple raw power.


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

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