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

Excel导出导出对ValueMappingAttribute的支持问题 #272

Closed
xl-wenqiang opened this issue May 26, 2021 · 2 comments
Closed

Excel导出导出对ValueMappingAttribute的支持问题 #272

xl-wenqiang opened this issue May 26, 2021 · 2 comments
Labels
area-excel excel bug Something isn't working

Comments

@xl-wenqiang
Copy link
Collaborator

xl-wenqiang commented May 26, 2021

目前在Excel导出时,不支持以下枚举值映射方式:
[ValueMapping("男", 0)]
[ValueMapping("女", 1)]
仅支持:
[ValueMapping("男", “man”)]
而在导入时,则是反过来,即必须是:
[ValueMapping("男", 0)]
[ValueMapping("女", 1)]
而不是:
[ValueMapping("男", “Man”)]
[ValueMapping("女", “Female”)]

@xl-wenqiang xl-wenqiang added bug Something isn't working area-excel excel labels May 26, 2021
@xl-wenqiang xl-wenqiang changed the title Excel导出支持枚举值的ValueMappingAttribute映射 Excel导出导出对ValueMappingAttribute的支持问题 May 26, 2021
@xl-wenqiang
Copy link
Collaborator Author

群里反馈:
[ValueMapping("男", 0)]
导入没问题,导出模板也没问题
导出数据时,值还是0 而不是男

@xl-wenqiang xl-wenqiang reopened this May 29, 2021
@hueifeng
Copy link
Member

hueifeng commented Jun 1, 2021

经验证在ValueMapping非字符串的情况下,可以返回对应的值。
https://github.com/dotnetcore/Magicodes.IE/blob/master/src/Magicodes.ExporterAndImporter.Tests/ExcelExporter_Tests.cs#L758
关于此处
Import

[ValueMapping("男", 0)]

Export

[ValueMapping("男", 0)]

可正常使用,所以关闭此issue。

@hueifeng hueifeng closed this as completed Jun 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-excel excel bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants