Click here to Skip to main content
15,898,371 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
See more:
Hi,

ProductCode  ProductName   Qty  Price  TotalPrice
10001         xxxxxxxxx     1     250    250
10002         xxxxxxxxx     1     450    450
                                      -----------
                                   TOTAL 700
                                     ------------

In richtextbox how to set columns, rows and set the length of the content. can u pl help me out.


Regards
Rajesh
Posted
Updated 30-Nov-11 23:26pm
v6
Comments
Sergey Alexandrovich Kryukov 21-Nov-11 2:14am    
Not enough information, tag it: WPF, Forms, reports, what?
--SA
Richard MacCutchan 1-Dec-11 10:56am    
I have deleted your duplicate of this question. If you have additional comments or information then use the "Improve Question" link.

you can generate this report by gridview ,datalist or rdlc report and to print use PrintHelper Class
 
Share this answer
 
Comments
Rajesh Vetrivel 21-Nov-11 1:33am    
Dear Uma Shankar,
I'm Sorry, I want in Windows Application(C#). plese help me out.
uspatel 21-Nov-11 2:19am    
you can use to print form visual basic poerpack sprint Form control
http://msdn.microsoft.com/en-us/library/cc424981(v=vs.80).aspx
uspatel 21-Nov-11 2:21am    
alternative is Use PrintDocument Class
http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx
You can use The Crystal Report because Crystal Reports makes it easy to create simple reports, and also has comprehensive tools that you need to produce complex or specialized reports in csharp and other programming languages.
You will get Plenty of article in Google for Crystal Report
Have a look there
How to Create a Crystal Report using C# and MySQL[^]
http://social.msdn.microsoft.com/Forums/en-NZ/vscrystalreports/thread/c4782911-8bfb-43f8-8206-3e523eff4b6a[^]
C# Crystal Reports Tutorial[^]
 
Share this answer
 
Comments
Rajesh Vetrivel 21-Nov-11 2:29am    
Dear Ravi,
In Crystal Report how to set the size for the printout. In Crystal Report Printout only taken A4 size Only
private PrintPreviewDialog pPreviewDialog;
        private PrintDocument pDoc;


private void buttprintReport_Click_1(object sender, EventArgs e)
        {
            try
            {
               
                pPreviewDialog.Show();
                pDoc.Print();
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message.ToString());
            }
        }
// this is the example printing some data check this and try in your code



void pDoc_PrintPage(object sender, PrintPageEventArgs e)
        {
            Graphics g = e.Graphics;
            int x = 150;
            int y = 150;
            int cell_height = 0;
            int colCount = dataGridView1.ColumnCount;
            int rowCount = dataGridView1.RowCount - 1;
            int current_col = 0;
            int current_row = 0;
            string value = "";

            Rectangle cell_border;
            SolidBrush brush = new SolidBrush(Color.Black);

            while (current_row < rowCount)
            {

                while (current_col < colCount)
                {
                    x += dataGridView1[current_col, current_row].Size.Width;
                    cell_height = dataGridView1[current_col, current_row].Size.Height;
                    cell_border = new Rectangle(x, y, dataGridView1[current_col, current_row].Size.Width, dataGridView1[current_col, current_row].Size.Height);
                    value = dataGridView1[current_col, current_row].Value.ToString();
                    g.DrawRectangle(new Pen(Color.Black), cell_border);
                    g.DrawString("      " + value, new Font("tahoma", 8), brush, x, y);
                    current_col++;
                }

                current_col = 0;
                current_row++;
                x = 150;
                y += cell_height;
            }

        }
<pre>
 
Share this answer
 
v4
Comments
Richard MacCutchan 1-Dec-11 4:52am    
Use <pre> tags around code!
ganeshbdas 1-Dec-11 4:57am    
chk
Anuja Pawar Indore 1-Dec-11 5:24am    
You must uncheck "Treat my content as plain text, not as HTML"

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