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,通过注解设置别名后,setOnlyAlias=true不起作用 #3531

Closed
littleeyes opened this issue Apr 1, 2024 · 5 comments
Closed
Labels

Comments

@littleeyes
Copy link

版本情况

JDK版本: openjdk_8_201
hutool版本: 5.8.16(请确保最新尝试是否还有问题)

image image image 设置只写出加了别名的字段,但是实际依然全部字段都导出了
@gg1229505432
Copy link
Contributor

ApiModelProperty 这个注解是这个吗? : io.swagger
swagger-annotations
1.6.8

@littleeyes
Copy link
Author

ApiModelProperty 这个注解是这个吗? : io.swagger swagger-annotations 1.6.8

是的

@gg1229505432
Copy link
Contributor

Bean中设置@alias时,setOnlyAlias是无效的,这个参数只和addHeaderAlias配合使用,原因是注解是Bean内部的操作,而addHeaderAlias是Writer的操作,不互通。

@gg1229505432
Copy link
Contributor

你可以下载hutool源码, 在这里查看示例: hutool-poi/src/test/java/cn/hutool/poi/excel/Issue2899Test.java

@gg1229505432
Copy link
Contributor

image

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

No branches or pull requests

3 participants