ExportCSV : How to change delimeter

3 posts, 0 answers
  1. Filleau
    Filleau avatar
    114 posts
    Member since:
    Jun 2006

    Posted 09 Dec 2010 Link to this post

    Hi

    How I can change the comma separated when I use the ExportCSV
    I want to use ";"  and no "," for the delimeter

    Thanks

    Anthony
  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 09 Dec 2010 Link to this post

    Hello,

    As far as I'm aware this is not currently possible.

    In the Telerik.WinControls.UI.Export.CSV namespace there is a RowElement class. In this class exists a Protected sub  called RenderChildElements.
    This performs the following action:

    VB
    Protected Overrides Sub RenderChildElements(ByVal sb As StringBuilder)
        If (Me._cells.Count > 0) Then
            Dim element As CellElement
            For Each element In Me._cells
                element.Render(sb)
                If (Me._cells.IndexOf(element) < (Me._cells.Count - 1)) Then
                    sb.Append(",")
                End If
            Next
            sb.AppendLine
        End If
        MyBase.RenderChildElements(sb)
    End Sub

    C#
    protected override void RenderChildElements(StringBuilder sb)
    {
        if (this._cells.Count > 0)
        {
            foreach (CellElement element in this._cells)
            {
                element.Render(sb);
                if (this._cells.IndexOf(element) < (this._cells.Count - 1))
                {
                    sb.Append(",");
                }
            }
            sb.AppendLine();
        }
        base.RenderChildElements(sb);
    }
      
      

    As you can see, the delimiter is hard coded and cannot be changed. I would suggest a feature request to Telerik that this is repplaced with a RadDelimiter that can be set as a property after instantiating the ExportToCSV class.

    Hope that helps
    Richard
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 14 Dec 2010 Link to this post

    Hi guys,

    Indeed, Richard is right and currently we do not support changing the CSV delimiter in ExportToCSV. We will consider adding this feature in one of the next releases.

    All the best,
    Martin Vasilev
    the Telerik team
    Check out the Q1 2011 Roadmap for Telerik Controls for Windows Forms.
Back to Top