Open Coeus35 opened 5 days ago
We're looking into this issue, thanks for reporting!
We are going to need a clearer example of this error and a reproducible code sample. It seems as though it works fine for example if using the following code:
internal class CamelCasedClass
{
public string IdOfThisInstance { get; set; }
}
public void ParseCamelCasedHeaders()
{
var items = new List<CamelCasedClass>()
{
new CamelCasedClass(){ IdOfThisInstance = "123" }
};
using (var pck = new ExcelPackage(new MemoryStream()))
{
var sheet = pck.Workbook.Worksheets.Add("sheet");
sheet.Cells["C1"].LoadFromCollection(items, c =>
{
c.PrintHeaders = true;
c.HeaderParsingType = HeaderParsingTypes.CamelCaseToSpace;
});
Assert.AreEqual("Id Of This Instance", sheet.Cells["C1"].Value);
}
}
It seems to parse the the header to space without issue. What type of collection are you using and in what way?
The collection is an IEnumerable of an object model. One difference is that I do have the model decorated with EpplusTableColumn for proper ordering.
[EpplusTable(ShowTotal = true)]
public abstract class BaseBillingReportExportModel
{
[EpplusTableColumn(Order = 0, TotalsRowLabel = "Totals", NumberFormat = "m/d/yyyy")]
public DateTime RegistrationDate { get; set; }
[EpplusTableColumn(Order = 1)]
public string RegistrantName { get; set; }
}
EPPlus usage
Commercial use (I have a commercial license)
Environment
.NET 6.0
Epplus version
7.1.3 - 7.2.1
Spreadsheet application
Excel Tables
Description
When setting HeaderParsingType via LoadFromCollection, it no longer formats HeaderParsingTypes.CamelCaseToSpace correctly