ExcelMapper icon indicating copy to clipboard operation
ExcelMapper copied to clipboard

valueparser not work when call Fetch() function

Open yangzhixiao opened this issue 1 year ago • 3 comments

valueparser will not callback Platform: net 8.0

yangzhixiao avatar Jan 16 '24 08:01 yangzhixiao

Can you provide a code snippet that shows the issue?

mganss avatar Jan 16 '24 12:01 mganss

Can you provide a code snippet that shows the issue?

Func<string, object, object> parser = (key, value) =>
{
    if (value is string s && s.Contains(",") && s.Split(",").All(x => int.TryParse(x, out int _)))
        return new Point(int.Parse(s.Split(",")[0]), int.Parse(s.Split(",")[1]));
    return value;
};
ExcelMapper excelMapper = new ExcelMapper();
excelMapper.Save("Config.xlsx", mapInfos, "MapInfo", true, converter);

yangzhixiao avatar Jan 16 '24 13:01 yangzhixiao

I can't repro. In your example the Func variable is called parser but you're passing a different variable named converter to the Save method. Could that be the cause?

mganss avatar Jan 17 '24 17:01 mganss