This is a migrated thread and some comments may be shown as answers.

Problems in printing grid with multiline field

1 Answer 123 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Felice
Top achievements
Rank 1
Felice asked on 17 Jan 2014, 04:57 PM
I have a gridView in a winform. I have set one of the column "Note" to:
wraptext= true
multiline= true

This is my print button:
private void BtnPrint(object sender, EventArgs e)
        {
            GridPrintStyle style = new GridPrintStyle();
            style.FitWidthMode = PrintFitWidthMode.FitPageWidth;     
            style.PrintHeaderOnEachPage = true;
            this.radGridView1.PrintStyle = style;
            this.radGridView1.PrintPreview();       
        }
despite the above, the result I get, see picture attached, is not the expected one.The multilines field doesn't shows properly the content. Part of the text is out of the visible box.
I have tried with several printers but the problem is always the same.
What I can do to solve this problem?

1 Answer, 1 is accepted

Sort by
0
Ralitsa
Telerik team
answered on 20 Jan 2014, 08:40 AM
Hi Felice, 

Thank you for contacting us. 

You need to set the AutoSizeRows property which is indicating whether row height in a RadGridView will expand for multiline cell text. You can set the AutoSizeRows property to true before printing and set it back to false when the dialog closes, or you can have it set to true all the time.

Unfortunately we also have a bug logged in our Public Issue Tracking System related to this property. 
You can read more about it, vote and subscribe for changes on this address: PITS issue. The issue will be resolved in our future releases. 

Currently, the possible workaround is to scroll to the bottom of the grid and then restore the scroll's value so that you wouldn't notice it has been moved. Please take a look at the following example: 
private void radButton1_Click(object sender, EventArgs e)
{
    this.radGridView1.AutoSizeRows = true;
 
    GridPrintStyle style = new GridPrintStyle();
    style.FitWidthMode = PrintFitWidthMode.FitPageWidth;
    style.PrintHeaderOnEachPage = true;
    this.radGridView1.PrintStyle = style;
 
    int save = this.radGridView1.TableElement.VScrollBar.Value;
    this.radGridView1.TableElement.ScrollTo(this.radGridView1.Rows.Last().Index, this.radGridView1.Columns.Last().Index);
    this.radGridView1.TableElement.VScrollBar.Value = save;
 
    this.radGridView1.PrintPreview();
}

I hope this will help. Do not hesitate to write back with further questions.

Regards,
Ralitsa
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Felice
Top achievements
Rank 1
Answers by
Ralitsa
Telerik team
Share this question
or