Writing empty Collections to Excel do not produce Headers
Hi, when I execute the following code:
var excel = new ExcelMapper();
var products = Enumerable.Empty<ProductRecord>().ToList();
var file = @"productssaveemptyrecord.xlsx";
//excel.SkipBlankCells = false; --> This does the magic
excel.CreateMissingHeaders = true;
excel.Save(file, products);
My Expectation is: An Excel file with one line header and no further data is Produced
What I observe: An empty Excel file is produced. Empty in a sense, that it actually does not contain any header.
Workaround: Despite any hints in the comment for the SkipBlankCells Property, Setting it to false leads to the desired behaviour.
How to fix: SkipBlankCells does affect how Excels are written. This should be reflected in the comment. I would recommend to introduce a new property to control the behaviour, if header lines or empty collections are produced.
Kind regards, Sebastian
There is the property CreateMissingHeaders. Does that work for you?
I have already added it in my example to show it has no or at least not the desired effect.
Oops, I missed that, sorry. I'll add documentation to the SkipBlankCells property.