Hi,
I have a problem with export to pdf from RadGrid. After exporting my pdf doesn't look well:
http://imageshack.us/photo/my-images/825/errexport.png/
Not all data from grid are in that document and there are no polish chars in that pdf ('#').
My grid has a lot of data and set page orientation to landscape isn't solution.
How to fix this?
I have a problem with export to pdf from RadGrid. After exporting my pdf doesn't look well:
http://imageshack.us/photo/my-images/825/errexport.png/
Not all data from grid are in that document and there are no polish chars in that pdf ('#').
My grid has a lot of data and set page orientation to landscape isn't solution.
How to fix this?
13 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 27 May 2011, 02:27 PM
Hello Wnl,
The following demo shows export to pdf property of RadGrid. Please make a double check with your code and check whether you can reproduce the issue.
Grid / Export to PDF.
Thanks,
Princy.
The following demo shows export to pdf property of RadGrid. Please make a double check with your code and check whether you can reproduce the issue.
Grid / Export to PDF.
Thanks,
Princy.
0

wnl
Top achievements
Rank 1
answered on 27 May 2011, 02:32 PM
But what with your solution when grid is very wide (more then one page width)? How the pdf will look?
0
Hello Wnl,
Not all data from grid are in that document and there are no polish chars in that pdf ('#').
You can set the default font to Arial Unicode MS using the DefaultFontFamily property as shown below:
But what with your solution when grid is very wide (more then one page width)?
My grid has a lot of data and set page orientation to landscape isn't solution.
There are different options - you can combine them if needed:
- do not set explicit width (clear the width property before exporting)
- use a larger page size - you can set it in absolute units (mm, inch and so on)
- decrease the page margins
- use smaller and/or narrower fonts
Note that the overflowing text content will be automatically carried over the next line if you have a whitespace characters inside.
PDF export
Best regards,
Daniel
the Telerik team
Not all data from grid are in that document and there are no polish chars in that pdf ('#').
You can set the default font to Arial Unicode MS using the DefaultFontFamily property as shown below:
<
ExportSettings
>
<
Pdf
DefaultFontFamily
=
"Arial Unicode MS"
/>
</
ExportSettings
>
But what with your solution when grid is very wide (more then one page width)?
My grid has a lot of data and set page orientation to landscape isn't solution.
There are different options - you can combine them if needed:
- do not set explicit width (clear the width property before exporting)
- use a larger page size - you can set it in absolute units (mm, inch and so on)
- decrease the page margins
- use smaller and/or narrower fonts
Note that the overflowing text content will be automatically carried over the next line if you have a whitespace characters inside.
PDF export
Best regards,
Daniel
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0

wnl
Top achievements
Rank 1
answered on 30 May 2011, 07:43 AM
1. How to set font in code using Telerik 2010.1.519.35? I don't see any appropriate property. If there isn't possible how to fix this with my version of Telerik?
2. How to clear width property? The code:
doesn't work.
2. How to clear width property? The code:
grid.ExportSettings.Pdf.PageWidth = Unit.Empty;
0

Shinu
Top achievements
Rank 2
answered on 30 May 2011, 10:38 AM
Hello Wml,
Please take a look at the following forum thread.
Changing Export to PDF fonts.
Thanks,
Shinu.
Please take a look at the following forum thread.
Changing Export to PDF fonts.
Thanks,
Shinu.
0
Hello Wnl,
1. How to set font in code using Telerik 2010.1.519.35? I don't see any appropriate property. If there isn't possible how to fix this with my version of Telerik?
You have to use inline styles:
2. How to clear width property? The code:
Do you want reset the page size or I'm missing something? I'm not sure why you need to clear this value.
Regards,
Daniel
the Telerik team
1. How to set font in code using Telerik 2010.1.519.35? I don't see any appropriate property. If there isn't possible how to fix this with my version of Telerik?
You have to use inline styles:
item[
"OriginalName"
].Style[
"font-family"
] =
"Arial Unicode MS"
;
2. How to clear width property? The code:
Do you want reset the page size or I'm missing something? I'm not sure why you need to clear this value.
Regards,
Daniel
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0

wnl
Top achievements
Rank 1
answered on 31 May 2011, 07:38 AM
1. Which event should I use for this:
item[
"OriginalName"
].Style[
"font-family"
] =
"Arial Unicode MS"
;
0
Inside the ItemCreated server handler of the grid, wnl. See the code-behind of this live demo for details.
Best regards,
Daniel,
the Telerik team
Best regards,
Daniel,
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0

wnl
Top achievements
Rank 1
answered on 02 Jun 2011, 08:05 AM
But the code inside the ItemCreated will change my font in the radgrid?
I don't want to overide my css rules with different font in the ItemCreated. Is any other solution?
I don't want to overide my css rules with different font in the ItemCreated. Is any other solution?
0

Princy
Top achievements
Rank 2
answered on 02 Jun 2011, 08:32 AM
Hello Wnl,
In order to achieve this try the same in ItemCommand event and try setting the font by looping through each item.
C#:
Princy.
In order to achieve this try the same in ItemCommand event and try setting the font by looping through each item.
C#:
protected
void
RadGrid2_ItemCommand(
object
sender, GridCommandEventArgs e)
{
if
(e.CommandName ==
"ExportToPdf"
)
{
foreach
(GridDataItem item
in
RadGrid2.MasterTableView.Items)
{
item[
"ColumnUniqueName"
].Style[
"font-family"
] =
"Arial Unicode MS"
;
}
}
}
Thanks,Princy.
0

wnl
Top achievements
Rank 1
answered on 02 Jun 2011, 10:34 AM
I checked my code and I can't use your code.I have a separate button above grid with export to pdf. So RadGrid2_ItemCommand doesn't fire. Any ideas?
0

Shinu
Top achievements
Rank 2
answered on 02 Jun 2011, 12:08 PM
Hello Wnl,
Try the following code in external button click.
C#:
Thanks,
Shinu.
Try the following code in external button click.
C#:
protected
void
DownloadPDF_Click(
object
sender, EventArgs e)
{
RadGrid1.ExportSettings.IgnorePaging =
true
;
RadGrid1.ExportSettings.OpenInNewWindow =
true
;
foreach
(GridDataItem item
in
RadGrid1.MasterTableView.Items)
{
item[
"ColumnUniqueName"
].Style[
"font-family"
] =
"Arial Unicode MS"
;
}
RadGrid1.MasterTableView.ExportToPdf();
}
Thanks,
Shinu.
0

wnl
Top achievements
Rank 1
answered on 02 Jun 2011, 02:16 PM
Still without success.