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

[Solved] Export to pdf column width

3 Answers 293 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Abdelhak LAKNIN
Top achievements
Rank 1
Abdelhak LAKNIN asked on 07 Jan 2010, 04:50 PM
Hi,

I have a question about the exportToPdf functionnality of the RadGrid. I hope you'll help me :).

I use this code to generate a radgrid to pdf format :

RadGridComparisonLines.ExportSettings.IgnorePaging =

true;

 

RadGridComparisonLines.ExportSettings.Pdf.AllowPrinting =

true;

 

RadGridComparisonLines.ExportSettings.Pdf.PageLeftMargin =

Unit.Pixel(10);

 

RadGridComparisonLines.ExportSettings.Pdf.PageRightMargin =

Unit.Pixel(10);

 

RadGridComparisonLines.ExportSettings.ExportOnlyData =

false;

 

RadGridComparisonLines.MasterTableView.ExportToPdf();


These lines of codes generate a grid in pdf format where all columns have the same width (issue).
But there are some columns which need less width than others.

how can I do to autosize the columns please ?

Thank you.

Assembly Version : 2008.2.723.20
Telerik.Web.UI.dll

3 Answers, 1 is accepted

Sort by
0
Abdelhak LAKNIN
Top achievements
Rank 1
answered on 07 Jan 2010, 07:29 PM
I tried to set the width manually like that :

radgrid.MasterTableView.Columns["Name"].HeaderStyle.Width = unit.Pixelsl(30);

But it doesn't work.

When the content width of the cell is greater than the column width, the content is written on the next column and doesn't go to the next line...
0
Daniel
Telerik team
answered on 12 Jan 2010, 12:58 PM
Hello Abdelhak,

You can set the width through the HeaderStyle-Width property:
RadGrid1.MasterTableView.GetColumn("CategoryName").HeaderStyle.Width = Unit.Pixel(300);

PDF export help topic

Please note that the PDF engine splits the text only if it has an empty spaces. Otherwise the content will overflow in the adjacent cell.

Kind regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Abdelhak LAKNIN
Top achievements
Rank 1
answered on 30 Jan 2010, 12:01 AM
Thank you for your response. I understand now.
Tags
Grid
Asked by
Abdelhak LAKNIN
Top achievements
Rank 1
Answers by
Abdelhak LAKNIN
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or