Exporting to excel fails for column bound to datatype char

3 posts, 0 answers
  1. Tord
    Tord  avatar
    1 posts
    Member since:
    Feb 2013

    Posted 30 Apr 2013 Link to this post


    I have an object with a property of type char like this:

    public class DummyModel
           public string Stringtest { get; set; }
           public char Chartest { get; set; }

    When binding a grid to a list of this objects the values in the char property are displayed correctly in a grid column.

    But when I export the grid using ExcelML the column in Excel comes up empty.
    Doesn't ExcelML support exporting the char datatype?

  2. Stefan
    Stefan avatar
    2911 posts

    Posted 03 May 2013 Link to this post


    Due to Easter observations, we are currently operating with limited resources until May 7th. We will get back to you as soon as possible. Please excuse us for the introduced inconvenience.
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.

  3. Stefan
    Stefan avatar
    2911 posts

    Posted 22 May 2013 Link to this post

    Hello Tord,

    Please excuse me for the delayed reply. I managed to miss this thread somehow.

    To answer your question, the char data type is not recognized by Excel and this is why it is not displayed. To hand this case, you can use the ExcelCellFormatting event of the exporter, where you can convert the char to string in the exported document:
    void radButton1_Click(object sender, EventArgs e)
        ExportToExcelML exporter = new ExportToExcelML(this.radGridView1);
        string fileName = "C:\\ExportedData123.xls";
        exporter.ExcelCellFormatting += exporter_ExcelCellFormatting;
    void exporter_ExcelCellFormatting(object sender, Telerik.WinControls.UI.Export.ExcelML.ExcelCellFormattingEventArgs e)
        e.ExcelCellElement.Data.DataItem = Convert.ToString(e.GridCellInfo.Value);

    I hope that you find this useful. Once again, excuse me for the delay.

    RadChart for WinForms is obsolete. Now what?
Back to Top