I found this bit of code to export my data results 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 the data in Formatted mode. What's the code to replicate just "Export > Export To Excel"?
This functionality is not currently exposed for XhtmlWriter
, but there's a WriteCsv
method in LINQPad.Util
that might do what you want:
Util.WriteCsv (Customers, @"c:\temp\customers.csv");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With