Formatting Excel cells in export?

5 posts, 0 answers
  1. Michael
    Michael avatar
    2 posts
    Member since:
    Oct 2008

    Posted 18 Oct 2008 Link to this post


    I am going a bit crazy trying to accomplish the following formatting for Excel exports:

    1. set row (or cell) height
    2. set column width
    3. set row (or cell) backcolor and forecolor
    4. If using ExcelML, removing the dropdowns from the header row.
    5. If using ExcelFormat-html, setting font size (and color).

    It seems like there should be a way to do this.  I have tried:
    1. Using ExcelML format and setting styles in the ExcelML style events - I can get the backcolor/forecolor changed, but not width or height.
    2. Using ExcelFormat=html and trying to set the attributes in the radgrid columns as well as in the ExcelExportCellFormattingEvent.

    If I'm missing something or if there is a guide to formatting, please let me know!

    I am running into similar problems with PDF export as well.  In fact, I can't seem to get any kind of color styling in PDF.

    Thanks much,

  2. Rosen
    Rosen avatar
    3214 posts

    Posted 20 Oct 2008 Link to this post

    Hi Michael,

    You can accomplish the desired functionality very easily by adding ExcelML attributes to the created objects. I have attached a simple implementation of the requested behavior. For more information on ExcelML legal elements and attributes please refer to this msdn article here.
    I hope this information helps.

    All the best,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. DevCraft R3 2016 release webinar banner
  4. bradley baker
    bradley baker avatar
    97 posts
    Member since:
    Aug 2009

    Posted 23 Oct 2009 Link to this post

    How would I do this in VB?  Im trying to set the column widthand its not working.  It wont build.  Prperty access must assign to the property or use its value and Identifer expected are the two errors I get.

    Imports System  
    Imports System.Collections.Generic  
    Imports System.Configuration  
    Imports System.Data  
    Imports System.Data.Common  
    Imports System.Data.SqlClient  
    Imports System.Web.UI  
    Imports Telerik.Web.UI  
    Imports Telerik.Web.UI.GridExcelBuilder  
        Protected Sub SalesEXPGrid_ExcelMLExportRowCreated(ByVal source As ObjectByVal e As Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLRowCreatedArgs)  
            For Each col As ColumnElement In SalesEXPGrid.MasterTableView.Columns  
                col.Attributes["ss:Width"] = "200" 
        End Sub 
  5. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 20 Nov 2009 Link to this post

    Why are we using technology 8+ years old?  Isn't it about time you guys implemented Open XML (Office 2007) exports?
  6. Rosen
    Rosen avatar
    3214 posts

    Posted 25 Nov 2009 Link to this post

    Hello Mark,

    Thank you for your suggestion. I have forward it to our development department for future consideration.

    Kind regards,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top
DevCraft R3 2016 release webinar banner