styles not reflecting in ElementExporting event

4 posts, 0 answers
  1. Prithvi
    Prithvi avatar
    19 posts
    Member since:
    Jul 2012

    Posted 14 Mar 2012 Link to this post

    Hi,

    when the ext is xml and format is ExportFormat.ExcelML, stlyes written in ElementExporting are not getting reflected in the Excel file.


    public void rtlvForExport_ElementExporting(object sender, GridViewElementExportingEventArgs e)
    {
    if (e.Element == ExportElement.Cell
    && e.Value !=
    null

     

    && e.Value.GetType() ==

     

    this.SModel.RecordClassType)

     

    {e.Value =

     

    "";}
    if (e.Element == ExportElement.HeaderCell)

     

    {e.Background =

     

    Colors.LightGray;

     

    e.Foreground =

     

    Colors.Black;

     

    e.FontSize = 15;

    e.FontWeight =

     

    FontWeights.Bold;
    }

     

     

     

    else if ((e.Element == ExportElement.Cell) && (e.Value != null))

     

    {e.TextAlignment =

     

    TextAlignment.Center;

     

    e.TextAlignment =

     

    TextAlignment.Center; ;

     

    e.VerticalAlignment =

     

    VerticalAlignment.Center;
    }

     

     

     

    else if ((e.Element == ExportElement.Cell) && (e.Value.Equals("MANUFACTURED")))

     

    {

    e.Background =

     

    Colors.Magenta;

     

    e.Foreground =

     

    Colors.Black;

     

    }

    }

  2. Prithvi
    Prithvi avatar
    19 posts
    Member since:
    Jul 2012

    Posted 14 Mar 2012 Link to this post

    Please help me ASAP

    Thanks,
    Prithvi
  3. DevCraft banner
  4. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 14 Mar 2012 Link to this post

    Hello,

     You should use the ExportFormat.Html to get the styles applied.

    Kind regards,
    Didie
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  5. Gopinath
    Gopinath avatar
    63 posts
    Member since:
    Sep 2011

    Posted 06 Dec 2012 Link to this post

    thanks a lot it solved my problem too!!!
Back to Top