MiniExcel icon indicating copy to clipboard operation
MiniExcel copied to clipboard

DynamicColumns Name not working as expected

Open GianlucaLocri opened this issue 2 years ago • 1 comments

Description

I've tried this code to format my columns with custom name but it is not working as expected. Here is a minimal reproducible example:

dynamic results = new List<dynamic>();
var resultRow = new ExpandoObject() as IDictionary<string, Object>;

resultRow.Add("Code", 12345);
results.Add(resultRow);

var resultsExcelConfig = new OpenXmlConfiguration
{
   DynamicColumns = new DynamicExcelColumn[] {
      new DynamicExcelColumn("Code"){Name="Code Custom Name"},
   }
};

MiniExcel.SaveAs(myPath, results, configuration: resultsExcelConfig);

The resulting file has an empty column header with no data. If I omit the configuration, the code works but the column name is the default one...

empty.txt

GianlucaLocri avatar Oct 20 '22 16:10 GianlucaLocri