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

Grid Export to PDF - Can't override Times New Roman Font

4 Answers 102 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kellie
Top achievements
Rank 1
Kellie asked on 10 Dec 2010, 12:38 AM

I have been unable to successfully override the Times New Roman font in my PDF.
A screen shot of the PDF is attached.

Here is my raw HTML showing the newly applied styles but the font family, arial, is not getting applied to the PDF!

<table cellspacing="0" border="0" id="RadGridSearchResults_ctl00" style="width:100%;table-layout:auto;empty-cells:show;">
    <colgroup>
        <col style="width:75px" />
        <col style="width:75px" />
        <col style="width:150px" />
        <col style="width:75px" />
        <col style="width:100px" />
        <col  />
    </colgroup>
<thead>
        <tr style="background-color:WhiteSmoke;border-bottom-style:solid;border-bottom-width:1.5px;border-bottom-color:LightGrey;height:50px;">
            <th scope="col" style="font-weight:bold;font-family:arial;">Title Nbr</th><th scope="col" style="font-weight:bold;font-family:arial;">Reg Date</th><th scope="col" style="font-weight:bold;font-family:arial;">Type</th><th scope="col" style="font-weight:bold;font-family:arial;">Linc Nbr</th><th scope="col" style="font-weight:bold;font-family:arial;">Short Legal</th><th scope="col" style="font-weight:bold;font-family:arial;">Owner</th>
        </tr>
    </thead><tbody>
    <tr style="background-color:White;">
        <td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">001013760</td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    2000-01-14
                </td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    NOTIFICATION (RD ABAND=CREATE TITLE)
                </td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    0028274538
                </td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    0010083;A
                </td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    THE TOWN OF REDCLIFF.
                </td>
    </tr><tr style="background-color:WhiteSmoke;">
        <td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">001083587</td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    2000-03-31
                </td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    SUBDIVISION PLAN
                </td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    0028344687
                </td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    0010742;1;11
                </td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    THE TOWN OF REDCLIFF.
                </td>
    </tr><tr style="background-color:White;">
        <td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">001083587001</td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    2000-03-31
                </td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    SUBDIVISION PLAN
                </td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    0028344695
                </td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    0010742;1;14MR
                </td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    THE TOWN OF REDCLIFF.
                </td>
    </tr><tr style="background-color:WhiteSmoke;">
        <td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">001083587002</td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    2000-03-31
                </td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    SUBDIVISION PLAN
                </td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    0028344703
                </td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    0010742;1;12
                </td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    THE TOWN OF REDCLIFF.
                </td>
    </tr><tr style="background-color:White;">
        <td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">001083587003</td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    2000-03-31
                </td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    SUBDIVISION PLAN
                </td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    0028344711
                </td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    0010742;1;13
                </td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    THE TOWN OF REDCLIFF.
                </td>
    </tr><tr style="background-color:WhiteSmoke;">
        <td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">041236280010</td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    2004-06-23
                </td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    SUBDIVISION PLAN
                </td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    0030537865
                </td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    0412179;10;1
                </td><td style="text-align:left;vertical-align:middle;font-size:8pt;font-family:arial;">
                    THE TOWN OF REDCLIFF.
                </td>
    </tr>
    </tbody>
  
</table>


Here is my code that is applying the styles. All of the styles work EXCEPT for the font-family style. How to fix?

protected void RadGridSearchResults_ItemCreated(object sender, GridItemEventArgs e)
{
    if (isPdfExport)
    {
        if (e.Item != null)
        {
            if (e.Item.ItemType == GridItemType.AlternatingItem)
            {
                e.Item.Style["background-color"] = "WhiteSmoke";
            }
            else
            {
                e.Item.Style["background-color"] = "White";
            }
            if (e.Item is GridHeaderItem)
            {
                var headerItem = (GridHeaderItem)e.Item;
                headerItem.Style["background-color"] = "WhiteSmoke";
                headerItem.Style["border-bottom-style"] = "solid";
                headerItem.Style["border-bottom-width"] = "1.5px";
                headerItem.Style["border-bottom-color"] = "LightGrey";
                headerItem.Style["height"] = "50px";
                foreach (TableCell cell in headerItem.Cells)
                {
                    cell.Style["font-weight"] = "bold";
                    cell.Style["font-family"] = "arial";
                }
            }
            if (e.Item is GridDataItem)
            {
                var item = (GridDataItem)e.Item;
                foreach (TableCell cell in item.Cells)
                {
                    cell.Style["text-align"] = "left";
                    cell.Style["vertical-align"] = "middle";
                    cell.Style["font-size"] = "8pt";
                    cell.Style["font-family"] = "arial";
                }
            }
        }
    }
}

4 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 15 Dec 2010, 09:56 PM
Hello Kellie,

I reproduced the problem in a local test. Please note that we will need some time to investigate the issue. I will update this forum thread when I have more information about this problem.
Thank you for your understanding.

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
Daniel
Telerik team
answered on 28 Dec 2010, 02:38 PM
Hello Kellie,

Please test the attached project on your end. Note that you have to use the latest version of RadControls for ASP.NET AJAX in order for this to work properly.
Looking forward to hearing from you.

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
Kellie
Top achievements
Rank 1
answered on 30 Dec 2010, 06:50 PM
While trying out your solution, I accidently got my old code to work by changing the case from "arial" to "Arial".

cell.Style["font-family"] = "Arial";

I also updated to version 2010.3.1215.35 so I'm not sure if updating it assisted with the solution or not.
Is it normal that font-family would be case sensitive?
0
Daniel
Telerik team
answered on 30 Dec 2010, 09:53 PM
Hello Kellie,

Yes, the font names should be set with their full name - the casing should be preserved.

As to the other question - there was a font-related bug in the previous version of RadControls for ASP.NET AJAX.

Let me know if you need more information.

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.
Tags
Grid
Asked by
Kellie
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Kellie
Top achievements
Rank 1
Share this question
or