Write to CSV file and export it?

后端 未结 6 592
悲哀的现实
悲哀的现实 2020-11-30 01:58

In C# ASP.net, could someone show me how I can write entries from an Array/List to a CSV file on the server and then open the file? I think the second part would be somethin

6条回答
  •  北海茫月
    2020-11-30 02:33

    Here's a very simple free open-source CsvExport class for C#. There's an ASP.NET MVC example at the bottom.

    https://github.com/jitbit/CsvExport

    It takes care about line-breaks, commas, escaping quotes, MS Excel compatibilty... Just add one short .cs file to your project and you're good to go.

    (disclaimer: I'm one of the contributors)

提交回复
热议问题