Dump to file
Instead of requiring excel or word installed on the client's machine, what the output could be dumped in csv format?
Copy/Pasting from the html output is not effective.

There are now methods in LINQPad’s Util class to do this (ToCsvString, WriteCsv, ToHtmlString, CreateXthmlWriter, etc).
-
Elias commented
here's an extension method i put together to send dumps to the file system
public static class DumpToFileExtensions
{
public class WriterWithdestination
{
public TextWriter Writer { get; }
public string FilePath { get; }
private DumpContainer dc { get;}
public DumpContainer LastDump { get;}
public WriterWithdestination(string filePath)
{
FilePath = filePath;
Writer = Util.CreateXhtmlWriter(true);
dc = new DumpContainer(Util.HorizontalRun(false, "output writing to ", new Hyperlinq(filePath, filePath))).Dump();
LastDump = new DumpContainer().Dump();
}
}
public static T DumpToFile<T>(this T obj, WriterWithdestination writer)
{
return obj.DumpToFile(writer, null);
}
public static T DumpToFile<T>(this T obj, WriterWithdestination writer, string title)
{
writer.LastDump.Content = "";
if (!string.IsNullOrWhiteSpace(title))
{
writer.LastDump.Content = Util.RawHtml(string.Format("<br/><strong>{0}</strong>", title)).DumpToFile(writer);
}
writer.Writer.Write(obj);
File.WriteAllText(writer.FilePath, writer.Writer.ToString());
writer.LastDump.Content = Util.VerticalRun(writer.LastDump.Content, obj);
return obj;
}
}And here's the usage example:
var list = new List<string> { "a", "b", "c" };
var myWriter = new DumpToFileExtensions.WriterWithdestination(@"c:\temp\output.html");list.DumpToFile(myWriter, "Hello world");