This is a migrated thread and some comments may be shown as answers.

ExportCSV : How to change delimeter

2 Answers 67 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Filleau
Top achievements
Rank 1
Filleau asked on 09 Dec 2010, 09:47 AM
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 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 09 Dec 2010, 01:32 PM
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
0
Martin Vasilev
Telerik team
answered on 14 Dec 2010, 06:29 PM
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.
Tags
GridView
Asked by
Filleau
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Martin Vasilev
Telerik team
Share this question
or