How to set styles to RAD Grid Group by fields in PDF

6 posts, 0 answers
  1. Radha
    Radha avatar
    19 posts
    Member since:
    Dec 2012

    Posted 03 Dec 2012 Link to this post

    Please help me how to set styles like text-alignment,font-family,font-size etc.. for group by fields while exporting to PDF from RAD GRID.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 03 Dec 2012 Link to this post

    Hi,

    Try the following code to achieve your scenario.
    C#:
    bool isexport = false;
    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
     isexport = true;
     if (e.Item is GridGroupHeaderItem && isexport)
     {
       foreach (TableCell cell in e.Item.Cells)
       {
         cell.Style.Add("color", "Red");
         cell.Style.Add("font-size","large");
       }
     }
    }

    Thanks,
    Princy.
  3. Radha
    Radha avatar
    19 posts
    Member since:
    Dec 2012

    Posted 04 Dec 2012 Link to this post

    It worked well.

    Thank you princy for the reply.

  4. Radha
    Radha avatar
    19 posts
    Member since:
    Dec 2012

    Posted 04 Dec 2012 Link to this post

    Every thing worked properly except setting the font family to verdana ,i am trying to set font family to verdana but while rendering it is taking as times new roman.please help to set the font family to verdana.
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 04 Dec 2012 Link to this post

    Hi,

    Unfortunately I cannot replicate the issue at my end. Here is the sample code that I tried which worked as expected.
    C#:
    bool isexport = false;
    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
     isexport = true;
     if (e.Item is GridGroupHeaderItem && isexport)
     {
       foreach (TableCell cell in e.Item.Cells)
       {
         cell.Style.Add("font-family", "Verdana");
       }
     }
    }

    Thanks,
    Princy.
  6. Radha
    Radha avatar
    19 posts
    Member since:
    Dec 2012

    Posted 06 Dec 2012 Link to this post

    Thanks prince.
      I changed from font-family to font-names and it worked well.
Back to Top