Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Guys,

I need a solution for my crystal report printing issue which i have stated below.

I have developed a bar-code printing option in my application where i have to print 4 column in a row. i have done it successfully but i have faced a issue by getting a empty row in my printer for example, "If i have given 24 items to print, it prints 4 rows correctly and also it prints me one empty row in last". So kindly some one help me to solve this issue i am on a heretic position. Also i have given my code below for check it. Thanks


C#
private void Form1_Load(object sender, EventArgs e)
        {            
            Barcodes barcodeDetails = new Barcodes();
            DataTable dataTable = barcodeDetails._Barcodes;
             
           BarcodeReport Report = new BarcodeReport();

            int blank_labels = 0;
            //int numberLabel =  Convert.ToInt16(o);// 3;

            string[] proid = p.Split(',');
            string[] proname = q.Split(',');
            string[] procost = r.Split(',');
            string[] prodate = s.Split(',');
            string[] prototal = o.Split(',');
            
            for (int j = 0; j < proid.Length; j++)
            {
                string id = proid[j].Trim();
                string name = proname[j].Trim();
                string cost = procost[j].Trim();
                string date = prodate[j].Trim();
                string Total = prototal[j].Trim();

                int numberLabel = Convert.ToInt16(Total);
                for (int i = 0; i < numberLabel; i++)
                {
                    DataRow drow = dataTable.NewRow();
                    if (blank_labels <= i)
                    {                         
                        drow["Barcode"] = "*";
                        drow["Barcode"] += id;// 
                        drow["Barcode"] += "*";

                        drow["ProductId"] = id;// 
                        drow["Product Name"] = name;// 
                        drow["Cost"] = "Rs. " + cost;
                        drow["Date"] = date;// 
                    }

                    dataTable.Rows.Add(drow);
                }
            }

            Report.Database.Tables["Barcodes"].SetDataSource((DataTable)dataTable);
            crystalReportViewer1.ReportSource = Report;
            crystalReportViewer1.Refresh();
         }
Posted
Updated 6-Jun-14 21:22pm
v2
Comments
DamithSL 7-Jun-14 3:39am    
debug and check dataTable having empty records before you set the datasource
Harrikanth 10-Jun-14 1:00am    
Ya. I have Empty Columns but Not Empty Rows. Even though i remove that columns, but the same issue is repeating. This issue is coming for single page print also
[no name] 17-Jun-14 8:44am    
Problem is with your crystal report file.

Something is wrong with the detail section in crystal report file

Also remove footer if available.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900