donnytian / Npoi.Mapper

Use this tool to import or export data with Excel file. The tool is a convention based mapper between strong typed object and Excel data via NPOI.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Apply .Trim() when reading the column names by default.

xDidier901 opened this issue · comments

Hi, I have encountered this issue where defining a class to map my Excel file, if the name of the column in the Excel file has an space at the end, the mapping will fail and will parse everything as null/default.

Example:

public class MyClass
    {
        [Column("Property")]
        public string MyProperty { get; set; }
    }

In this case, if the name of the column in the Excel file is "Property " (<--- check the extra space at the end) the mapping will fail and will give you everything as null.

It would be nice if by default, it would add a .Trim() at the end of the columnName so we can skip this kind of situations.

fixed in v3.5