CSV export with semicolon as field delimiter instead of a comma.

14 posts, 0 answers
  1. Daniel
    Daniel avatar
    16 posts
    Member since:
    Oct 2007

    Posted 10 Mar 2011 Link to this post

    Hi,

    When exporting a report to CSV it used a comma as field delimiter but I would like to use a semicolon instead. I did not find a way to change the delimiter. The documentation gives some hope as it  states: "The default field delimiter string is a comma (,)." , so there should be a way to use a non-default delimiter instead. Does anyone know the trick?

    Regards,

    Daniel


  2. Peter
    Admin
    Peter avatar
    1611 posts

    Posted 15 Mar 2011 Link to this post

    Hi Daniel,

    Changing the CSV delimiter is not possible in the current version. We would research if there is a way to present the option to change the delimiter used for the CSV export and if feasible, would implement this for subsequent versions of the product.

    All the best,
    Peter
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. DevCraft banner
  4. Daniel
    Daniel avatar
    16 posts
    Member since:
    Oct 2007

    Posted 16 Mar 2011 Link to this post

    Hi Peter,

    Thanks for your reply. We are shipping our software to Germany where the standard field delimiter is a semicolon (also see wikipedia article on CSV). Is it possible to get around with this (in the current version) by triggering a post-process step after the CSV is generated, so that I can replace the comma values by semicolon afterwards?

    Please keep me updated on your research for adding this functionality in subsequent versions of the product.

    Daniel
  5. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 18 Mar 2011 Link to this post

    Hi Daniel,

    The specifics of the CSV rendering format are listed in the Design Considerations for CSV Rendering help article. Customizations like the one you describe are not supported.
    Still you can either:

    Kind regards,
    Steve
    the Telerik team
  6. Alcide Burato
    Alcide Burato avatar
    14 posts
    Member since:
    Mar 2011

    Posted 02 May 2011 Link to this post

    Hello.
    any news regards this issue? is it possible to export to csv using the local system setting for the List Delimiter?

    thanks
    Alcide
  7. Massimiliano Bassili
    Massimiliano Bassili avatar
    323 posts
    Member since:
    May 2006

    Posted 03 May 2011 Link to this post

    I would have to agree with Telerik on this one. Their CSV export is exactly by specifications and changing the delimiters results in different format e.g. for Germany where the decimal separator is a comma and the value separator is a semicolon, the format is called SSV (semicolon-separated values). Read more about it in http://en.wikipedia.org/wiki/Comma-separated_values.

    Cheers!
  8. Daniel
    Daniel avatar
    16 posts
    Member since:
    Oct 2007

    Posted 03 May 2011 Link to this post

    Hi all,

    Apart from whether Telerik is exactly following the mentioned description we --as a customer-- are in need of this quite common functionality (to be able to change the field delimiter in order to serve our German customers). Strange enough does Telerik provide this functionality in their other products, e.g. see their RadGrid help page: http://www.telerik.com/help/aspnet-ajax/grid-csv-export.html which shows how to configure this functionality:
    <ExportSettings> <Csv ColumnDelimiter="Tab" RowDelimiter="NewLine" FileExtension="TXT" EncloseDataWithQuotes="true" /> </ExportSettings>

    I would like to see similar config functionality in the report export but it is not yet provided by the reporting engine. In my opinion it should not be complicated for them to add this functionality anyway but it does not seem to have priority.

    Regards,

    Daniel

  9. Alcide Burato
    Alcide Burato avatar
    14 posts
    Member since:
    Mar 2011

    Posted 03 May 2011 Link to this post

    Hi Massimilano,

    unfortunately there's million of customers that are using MS Excel where files with ".csv" extension are opened parsing it using the semicolon as delimiter instead of the comma. For this reason, because Microsoft does'nt respect the CSV standard, Telerik have to give the opportunity to change the List Separator Character if Telerik desires to be more competitive.

    The standard stuff are really good thing but when the reality differs from the standard it is better to open the mind if you want to survive in this hard sick world ;o)

    I'm temporarily solving this problem using regular expression to replacing the comma with semicolon on the output csv file, but I'd like one day to have this functionallity managed directly from telerik exporting engine.

    string origSeparator = "\",\"";
    string destSeparator = "\";\"";
     
    StreamWriter sw = new StreamWriter(destFileName, true);
    using (StreamReader sr = new StreamReader(origFileName))
    {
     String line;
     while ((line = sr.ReadLine()) != null)
     {
       sw.WriteLine(Regex.Replace(line, origSeparator, destSeparator));
       sw.Flush();
     }
    }
    sw.Close();


    Best regards,
    Alcide
  10. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 12 Oct 2011 Link to this post

    Hi guys,

    You would be happy to know that in Q2 2011 SP1 we've added the ability to specify the field delimiter in CSV. Two new CSV Device Information Settings have been introduced due to this: FieldDelimiter and Qualifier. For more information refer to the latter article.

    Greetings,
    Steve
    the Telerik team

    Q2’11 SP1 of Telerik Reporting is available for download (see what's new). Get it today.

  11. Grigore Dolghin
    Grigore Dolghin avatar
    19 posts
    Member since:
    Mar 2010

    Posted 08 Jan 2012 Link to this post

    Hi
    I need to change the delimiter to tab character. However I couldn't find the documentation on how to do that. I have set the FieldDelimiter = "\t", but I got the literal \t in the exported csv. Tried "Tab", got this: "2Tab4142132000TabTab7.00Tab21.00Tab21.00Tab22.26"

    Can anyone tell me what's the correct syntax?

    Thanks
  12. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 09 Jan 2012 Link to this post

    Hello Grigore,

    The Tab representation in XML is &#009; so you should set that as value i.e.:

    <Telerik.Reporting>
        <Extensions>
          <Render>
            <Extension name="CSV">
              <Parameters>
                <Parameter name="FieldDelimiter" value=" " />
              </Parameters>
            </Extension>
          </Render>
        </Extensions>
      </Telerik.Reporting>

    Greetings,
    Steve
    the Telerik team

    Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

  13. Grigore Dolghin
    Grigore Dolghin avatar
    19 posts
    Member since:
    Mar 2010

    Posted 09 Jan 2012 Link to this post

    EDIT: Please disregard my answer, it works if I add the code like this:

    <Parameters>
                <Parameter name="FieldDelimiter" value="&#009;"/>
                <Parameter name="NoHeader" value="true"/>
                <Parameter name="NoStaticText" value="true"/>
    </Parameters>

    (The code you posted was helpful and misleading at the same time because the forum had replaced the &#009; with a space and I thought you're suggesting me to add an actual TAB character in the app.config. All is good now, thank you).
    =========================================================

    Hi, thanks for answering. Unfortunatelly, that's no go. I am using spaces instead of tabs in editor, so the tab character gets replaced with 4 spaces. Although I could temporarily allow spaces and enter that character then disable the tabs again, I will have to be very careful to not touch that file again, otherwise the tab will get replaced again, even without me knowing it.

    I will live with this, but please implement a "\t" or "Tab", or whatever, but something that can't be changed accidentally. Or, maybe, add a "Text file (tab delimited)" in export options list....

    Thank you.
  14. Autolog
    Autolog avatar
    12 posts
    Member since:
    Jun 2010

    Posted 29 Jul 2014 Link to this post

    I don't understand why it doesn't just use current culture, or, at the very least, the culture provided in the export options: CultureInfo.CurrentCulture.TextInfo.ListSeparator?
  15. KS
    KS avatar
    165 posts
    Member since:
    Oct 2012

    Posted 31 Jul 2014 in reply to Autolog Link to this post

    Hi,

    If it is taken from the current culture it cannot be changed if you need to follow a format presentation for all machines running the app. The culture info can be used with the ReportProcessor.RenderReport and the deviceInfo.

    -KS
Back to Top
DevCraft banner