Hello ! I have RadGrid with PDF exporting button on my page. All fonts on the page are "SegoeUI" and in the RadGrid too, but when I export grid data to PDF document the fonts in the table becomes like "Times New Roman"..
Tryied to add styles to RawHtml on PdfExporting event but nothing happened.
Tryied to add styles to RawHtml on PdfExporting event but nothing happened.
5 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 29 May 2012, 08:49 AM
Hello Grigory,
Try setting the font style in ItemCommand event as shown below.
C#:
Thanks,
Shinu.
Try setting the font style in ItemCommand event as shown below.
C#:
void
RadGrid1_ItemCommand(
object
sender, GridCommandEventArgs e)
{
if
(e.CommandName == RadGrid.ExportToPdfCommandName)
{
foreach
(GridDataItem item
in
RadGrid1.Items)
{
foreach
(TableCell cell
in
item.Cells)
{
cell.Style[
"font-family"
] =
"Segoe UI"
;
}
}
}
}
Thanks,
Shinu.
0
Grigory
Top achievements
Rank 1
answered on 29 May 2012, 09:09 AM
I have custom button and on the on click event I have grid1.MasterTableView.ExportToPdf() command.
Tried to add this code block on button click event before ExportToPDF() but this didn't help me.
Also tried to add this code to the ItemCreatedEvent but this didn't help me too.
P.S. In RadGrid on my aspx page all is okay , all fonts are SegoeUI.
Tried to add this code block on button click event before ExportToPDF() but this didn't help me.
Also tried to add this code to the ItemCreatedEvent but this didn't help me too.
P.S. In RadGrid on my aspx page all is okay , all fonts are SegoeUI.
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 29 May 2012, 10:46 AM
Hello,
Please try with below code snippet.
Thanks,
Jayesh Goyani
Please try with below code snippet.
<
ExportSettings
>
<
Pdf
DefaultFontFamily
=
"YourFontName"
/>
</
ExportSettings
>
Thanks,
Jayesh Goyani
0
Grigory
Top achievements
Rank 1
answered on 29 May 2012, 12:45 PM
Thanks a lot , this helped me .
0
Travis
Top achievements
Rank 1
answered on 01 Jul 2014, 09:57 AM
Hi Jayesh,
I tried the below mentioned tips but still no luck to export to pdf with desired font family.
1-
<ExportSettings>
<Pdf DefaultFontFamily="Gill Sans MT" />
</ExportSettings>
2-
<MasterTableView Font-Names="Gill Sans MT" >
3-
<style type="text/css">
.rgMasterTable
{
font-family: Gill Sans MT !important;
}
</style>
4-
protected void btnpdfCard_Click(object sender, ImageClickEventArgs e)
{
foreach (GridDataItem item in rgExportGrid.Items)
{
item.Style["font-family"] = "Gill Sans MT";
}
}
I am able to see the correct font in browser and export to excel. But when exported to PDF, it sets the font to like Times New Roman. Any idea, why I am not successful to export with "Gill Sans MT" pdf?
Thanks in advance.
I tried the below mentioned tips but still no luck to export to pdf with desired font family.
1-
<ExportSettings>
<Pdf DefaultFontFamily="Gill Sans MT" />
</ExportSettings>
2-
<MasterTableView Font-Names="Gill Sans MT" >
3-
<style type="text/css">
.rgMasterTable
{
font-family: Gill Sans MT !important;
}
</style>
4-
protected void btnpdfCard_Click(object sender, ImageClickEventArgs e)
{
foreach (GridDataItem item in rgExportGrid.Items)
{
item.Style["font-family"] = "Gill Sans MT";
}
}
I am able to see the correct font in browser and export to excel. But when exported to PDF, it sets the font to like Times New Roman. Any idea, why I am not successful to export with "Gill Sans MT" pdf?
Thanks in advance.