Using LinqPad's native Spreadsheet column header issue
I'm in the awkward position of needing to support a .net framework solution so I am tied entirely to LinqPad 5.
As such, I'm hoping that the improvement (dare I say, fix? ) could be back-ported.
var importWorkbook = Util.ToSpreadsheet(values, "Test", true);
Where values
is a List<Foo>
, and Foo
is:
public class Foo { public string HotPotato; }
My issue is that the schema of the spreadsheet I need to output is fixed and the column headers need space characters in them.
I had hoped that I could decorate the property with PropertyNameAttribute
and override the name, but looking at the logic it's just building the headers based on a .GetProperties()
call to the type.
As a workaround, I also tried to manipulate the .Cells
directly on the worksheet but couldn't get it to override the column value.
Comments
If you are looking for a workaround would it be feasible to convert values to a DataTable and change the ColumnName?
For example, if you use FastMember nuget package you can do something like