Open LJN-hzleaper opened 7 months ago
I can remove these columns one by one from output by Ignore
, but is there a batch way?
ExcelMapper mapper = new();
mapper.Ignore(typeof(Dto), nameof(Dto.Id));
mapper.Ignore(typeof(Dto), nameof(Dto.Name));
mapper.AddMapping(typeof(Dto), "Identity", nameof(Dto.Id));
mapper.AddMapping(typeof(Dto), "User Name", nameof(Dto.Name))
.ToExcelOnly();
mapper.Save("E:/Test.xlsx", GetData(), "Hi");
You can remove all mappings like so:
var typeMapper = mapper.TypeMapperFactory.Create(typeof(Dto));
typeMapper.ColumnsByName.Clear();
In my demo app, ExcelMapper always output extra columns that I dont't want. How to prevent it?