mganss / ExcelMapper

An Excel to object mapper. Maps POCOs to and from Excel. Configuration via convention, attributes, or fluent methods.
MIT License
793 stars 122 forks source link

Change Column Title #300

Closed BourgisDaniele closed 6 months ago

BourgisDaniele commented 6 months ago

Good morning, it would be very useful to have the ability to set the title of the columns, only those that have the title different from the property name. Currently I am forced to clean the list of columns and do AddMapping, otherwise the columns with different title are added at the end.

Thank you,

mganss commented 6 months ago

Does that happen if you add [Column] attributes?

BourgisDaniele commented 6 months ago

Thanks for the answer, but we can't use attributes, because we have different export for the same entity that must have different column titles ..

mganss commented 6 months ago

I've added SetMapping() methods which reset the mappings. For your use case you can use SetMapping instead of AddMapping to set the mapping for the properties whose names differ from the column while keeping the automatically created mappings for the other properties.