C#窗口形成水晶报表 [英] C# window forms crystal Reports

查看:68
本文介绍了C#窗口形成水晶报表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个单选按钮吗?
1)风景
2)人像
然后,我单击打印"按钮,但未显示打印数据"
请为什么不取消打印页面中的数据分页.
请感谢C#Windows窗体的进步

I did I have two Radio button
1)Landscape
2)Portrait
Then I clicked the Printbutton but Print data is not displaying
plz why is not displanying data in the print out page.
plz thanks advance in C# windows forms

private void btnprint_Click(object sender, EventArgs e)
        {
            ReportDocument doc = new ReportDocument();
            ReportClass objRep = new ReportClass();
            LoadReport rpt = new LoadReport();

            PrintDocument docprint = new PrintDocument();

           if (rptName == "ContingenyPlanning")
            {
                objRep = rpt.CreateContingencyPlanning(clientid);
 
            }
              else if (rptName == "RetirementPlanning")
            {
                objRep = rpt.CreateRetirmentPlanning(clientid);
 
            }
            
            // like to print.
            printDialog1.AllowSomePages = true;

            // Show the help button.
            printDialog1.ShowHelp = true;
         
            
           // doc.PrintOptions.PrinterName = printDialog1.PrinterSettings.PrinterName;


            // Set the Document property to the PrintDocument for  
            // which the PrintPage Event has been handled. To display the 
            // dialog, either this property or the PrinterSettings property  
            // must be set 
            if (rdbLandscape.Checked == true)
            {
                docprint.DefaultPageSettings.Landscape = true;
                docprint.DefaultPageSettings.PrinterSettings.DefaultPageSettings.Landscape = true;
               
                //doc.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
            }
            else
            {
                docprint.DefaultPageSettings.Landscape = false;
                docprint.DefaultPageSettings.PrinterSettings.DefaultPageSettings.Landscape = false;
                //doc.PrintOptions.PaperOrientation = PaperOrientation.Portrait;
            }


            if (rdbportrait.Checked == true)
            {
                docprint.DefaultPageSettings.Landscape = false;
                docprint.DefaultPageSettings.PrinterSettings.DefaultPageSettings.Landscape = false;
               // doc.PrintOptions.PaperOrientation = PaperOrientation.Portrait;

            }
            else
            {
                docprint.DefaultPageSettings.Landscape = true;
                docprint.DefaultPageSettings.PrinterSettings.DefaultPageSettings.Landscape = true;
                //doc.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
 
            }
            
            printDialog1.Document = docprint;

            DialogResult result = printDialog1.ShowDialog();

            // If the result is OK then print the document. 
            if (result == DialogResult.OK)
            {
                docprint.Print();
            }
        }

private void document_PrintPage(object sender,
        System.Drawing.Printing.PrintPageEventArgs e)
        {

            // Insert code to render the page here. 
            // This code will be called when the control is drawn. 

            // The following code will render a simple 
            // message on the printed document. 
            string text = "In document_PrintPage method.";
            System.Drawing.Font printFont = new System.Drawing.Font
                ("Arial", 35, System.Drawing.FontStyle.Regular);

            // Draw the content.
            e.Graphics.DrawString(text, printFont,
                System.Drawing.Brushes.Black, 10, 10);
        }

推荐答案

您要将打印转换为PDF吗?
如果是这样,请检查浏览器的兼容性.

如果不是,则必须检查数据库的char值或int值,这些值已设置为要在(RadioButtons)RDB中表示的标志.请检查是否从Backend中完美填充了这些值.

为了获得更好的解决方案,请制作一个带有2个复选框和单选按钮的简单报告..从数据库中填充位值,并检查其是否以简单格式正确打印.
谢谢
are you converting your print to PDF?
If so please check with browser compatibility.

If not then you gotta check with the char values or int values of database, which you had set for the flag to be representd in (RadioButtons)RDBs. Please check whether the values are been populated perfectly from Backend.

For better solution, Please make a simple report with 2 check box and radiobuttons.. populate the bit values from the database and check whether its printing well in the simple format.
Thanks


这篇关于C#窗口形成水晶报表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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