locked
Printing from a rich text box RRS feed

  • Question

  • Hi all,

    My windows form uses a rich text box. The contents of which are populated from a database. Auto wrap is set to true.

    My application let's people print labels and preview it first (not using the print dialog preview, but I have created a panel which lays all out. This is so they can alter the content if needed).

    The issue I have is: when the user clicks the preview button the text in the rich text box wraps and all is as should be. However, when it prints, it doesn't wrap.

     string
     sDesc = rtxtDesc.Text; <br/>
     string
    [] aDesc = sDesc.Split(Environment.NewLine);
       foreach
     (string
     sLine in
     aDesc)
       {
        writer.WriteLine(sLine); 
       }

    //above doesn't work, neither does:
    int iLine = rtxtDesc.Lines.Length;
    for (int i = 0; i < iLine; i++) ;
    {
    writer.WriteLine(rtxtDesc.Lines.Length = iLine);
    }
    You can see what I was trying to do (althought C# doesn't like this)

    I am using a string writer and a string builder to send the information to the printer.

    Any ideas?

     

    Dave

    Tuesday, September 21, 2010 11:17 AM

Answers