Newlines in Excel export
Options
Hello,
Consider the following data structure:
Dump:

Export to Excel:

Since the data table contains one row I'd expect two rows in Excel (one header row and one data row), as follows:
Expected output:

LINQPad 5.40.00
Excel for Office 365 MSO (16.0.11901.20070) 32 bit
Consider the following data structure:
new[,] { { "aa", "bb\r\ncc" } }
Dump:

Export to Excel:

Since the data table contains one row I'd expect two rows in Excel (one header row and one data row), as follows:
Expected output:

LINQPad 5.40.00
Excel for Office 365 MSO (16.0.11901.20070) 32 bit
Comments
-
In rich-text mode, LINQPad exports to Excel via HTML, so that constructs such as nested tables and multiple result sets can be exported. It looks like there's a bug here in how Excel treats the HTML.
If you're exporting a simple table, the most reliable approach is to generate a CSV file with Util.ToCSV, or use the Data Grid mode and export from there. However, you'll first need to write a helper method to convert the 2d array into a standard IEnumerable. -
I forgot about the grid mode.. which works better, thanks!