LinqPad - export to Excel without formatting

I found this bit of code to export my data to Excel:

List<User> users = .... var filename = "test.html"; var writer = LINQPad.Util.CreateXhtmlWriter(); writer.Write(users); System.IO.File.WriteAllText(filename, writer.ToString()); // Open the file in excel Process.Start("Excel" , filename); 

This exports data in format mode. What code should I copy only "Export> Export to Excel"?

+4
source share
1 answer

This function is not currently displayed for XhtmlWriter , but there is a WriteCsv method in LINQPad.Util that can do what you want:

 Util.WriteCsv (Customers, @"c:\temp\customers.csv"); 
+5
source

Source: https://habr.com/ru/post/1489577/


All Articles