locked
export datagrid to csv RRS feed

  • Question

  • Hi,

     

    I want to export a DataGrid contains chinese characters to a local csv file,but when I open it using excel 2003,I found I couldn't open csv correctly,what's wrong ,how can I fix it?

    Wednesday, May 28, 2014 2:40 PM

Answers

  • Hi,

    It might be caused by the DataGrid you exported contains chinese characters based on this article(http://www.codeproject.com/Articles/174370/A-Simple-GB-GBK-Encoder-for-Silverlight ) .the only encoding formats supported by Silverlight are UTF-8 and UTF-16. There are several solutions for this problem:
    1.Send the data that is being exported back to server, generate the CSV file on server and redirect user to download it.
    2.Send the data back to server and return the generated encoded binary format of the CSV file to the Silverlight app, then save it to a local file.
    3. Try to use the Excel 2007, this is the easiest way.
    4.Implement some methods to export GBK encoded file directly within Silverlight before Microsoft provides the solution.
    For more details, see link below:

    # Simple GB2312/GBK Encoder for Silverlight
    http://www.codeproject.com/Articles/174370/A-Simple-GB-GBK-Encoder-for-Silverlight

    Best Regards,
    Qimin Ding


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.




    • Marked as answer by iooejroej1 Monday, June 2, 2014 12:23 PM
    Thursday, May 29, 2014 8:55 AM