Hi,
How can i Set the column width in percentage in Export Pdf. I could set the column width in pixels and also it is worked in pdf file.
But i need to set the width in % because my all of the column widths are measured in %.
I used the same way of fixing the width in pixels but in % it is not working..
-Thanks
How can i Set the column width in percentage in Export Pdf. I could set the column width in pixels and also it is worked in pdf file.
But i need to set the width in % because my all of the column widths are measured in %.
I used the same way of fixing the width in pixels but in % it is not working..
-Thanks
6 Answers, 1 is accepted
0

John John
Top achievements
Rank 1
answered on 03 Mar 2010, 03:14 PM
Hi,
Any one please suggest me for my given question?
-Thanks
Any one please suggest me for my given question?
-Thanks
0

robertw102
Top achievements
Rank 1
answered on 03 Mar 2010, 03:42 PM
If you've set you column widths in percentage in you RadGrid then they will be used when you export it to pdf. Is this not the case?
0

John John
Top achievements
Rank 1
answered on 04 Mar 2010, 09:50 AM
Hi,
Yes, my all column widths are measured in percentage. But the look and feel of PDF file is not good. Because the width is not getting as i am given in percenatege. So how can I give column width in percenatgae to export PDF file.
I used the below code, but no use.
RadGrid1.MasterTableView.GetColumn("URL").HeaderStyle.Width = Unit.Percentage(5);
-Thanks
0
Hello John,
I'm afraid that column widths in percentage are not supported by RadGrid's PDF parser. You can manually convert the percentages to absolute units as demonstrated in the attached demo.
Regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
I'm afraid that column widths in percentage are not supported by RadGrid's PDF parser. You can manually convert the percentages to absolute units as demonstrated in the attached demo.
Regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0

John John
Top achievements
Rank 1
answered on 05 Mar 2010, 08:04 AM
Hi Daniel,
Thanks for your reply. But it shows an error in measurement because i am giving PDF width and height in inches and margins in pixels. So it returns negative value and shows the "Width must be non negative" error.
I am also having the feature of exporting excel in addition of exporting PDF. So width need to be measured in percenatage in excel file also.So what measurement logic can be applied for excel file.
Else is there any conversion scenario to convert the percenate to equal to pixel.
Regards,
John
Thanks for your reply. But it shows an error in measurement because i am giving PDF width and height in inches and margins in pixels. So it returns negative value and shows the "Width must be non negative" error.
I am also having the feature of exporting excel in addition of exporting PDF. So width need to be measured in percenatage in excel file also.So what measurement logic can be applied for excel file.
Else is there any conversion scenario to convert the percenate to equal to pixel.
Regards,
John
0
Hello John,
I'm not sure that I understand what is the point to set the page size and margin in different units? Nevertheless, you can modify the code to calculate the columns with whatever units you use.
To achieve the same functionality in HTML Excel, you should modify the code this way:
Kind regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
I'm not sure that I understand what is the point to set the page size and margin in different units? Nevertheless, you can modify the code to calculate the columns with whatever units you use.
To achieve the same functionality in HTML Excel, you should modify the code this way:
protected
void
RadGrid1_ItemCreated(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridHeaderItem && isExport)
{
GridHeaderItem item = e.Item
as
GridHeaderItem;
foreach
(GridColumn col
in
RadGrid1.MasterTableView.Columns)
{
if
(col.HeaderStyle.Width.Type == UnitType.Percentage)
{
double
size = RadGrid1.Width.Value;
Unit unit =
new
Unit(size * col.HeaderStyle.Width.Value / 100, RadGrid1.Width.Type);
col.HeaderStyle.Width = unit;
}
}
}
}
Kind regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.