1. First, replace \n or \r\n with String.valueOf((char)10) where a line break is required . Sometimes it can be used without replacement
2. After the first step is completed, the exported content may still not be able to wrap, you need to double-click the cell to wrap,
Add annotations to exported java entity classes
@ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER,
verticalAlignment = VerticalAlignmentEnum.CENTER,
wrapped = BooleanEnum.TRUE)
Notes:
HorizontalAlignmentEnum.CENTER: Centered horizontally
VerticalAlignmentEnum.CENTER: vertical center
wrapped = BooleanEnum.TRUE: causes wrapping to succeed
For other annotation information, please refer to: Detailed introduction to the common annotations of EasyExcel_A Ren_'s blog-CSDN blog_easyexcel java annotation