Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

valueparser not work when call Fetch() function #289

Open
yangzhixiao opened this issue Jan 16, 2024 · 3 comments
Open

valueparser not work when call Fetch() function #289

yangzhixiao opened this issue Jan 16, 2024 · 3 comments

Comments

@yangzhixiao
Copy link

valueparser will not callback
Platform: net 8.0

@mganss
Copy link
Owner

mganss commented Jan 16, 2024

Can you provide a code snippet that shows the issue?

@yangzhixiao
Copy link
Author

yangzhixiao commented Jan 16, 2024

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);

@mganss
Copy link
Owner

mganss commented Jan 17, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants