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

模板导出列表格式有误 #3768

Open
hhjsmm opened this issue Apr 18, 2024 · 0 comments
Open

模板导出列表格式有误 #3768

hhjsmm opened this issue Apr 18, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@hhjsmm
Copy link

hhjsmm commented Apr 18, 2024

建议先去看文档

快速开始常见问题

触发场景描述

返回的list不是最后一行,导出的Excel格式错乱了

触发Bug的代码

        ExcelWriter excelWriter = EasyExcel.write(os)
                .withTemplate(inputStream)
                .excelType(ExcelTypeEnum.XLSX)
                //.registerWriteHandler(mergePrevCol)
                .autoCloseStream(Boolean.FALSE)
                .build();

FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
List<Map<String, Object>> ttReason = reasonService.listMaps(tr);
if (CollectionUtils.isNotEmpty(ttReason)) {
ttReason.forEach(var -> {
String category = DictUtils.getDictLabel("QPMS_STATIONARY_FISH_BONE", String.valueOf(var.get("reason_category")));
var.replace("reason_category", category);

                String type = DictUtils.getDictLabel("QPMS_STATIONARY_FIVE_WHY", String.valueOf(var.get("reason_type")));
                var.replace("reason_type", type);
            });
        }

excelWriter.fill(new FillWrapper("tr", ttReason), fillConfig, writeSheet);

# 提示的异常或者没有达到的效果
<img width="846" alt="微信图片_20240418142508" src="https://github.com/alibaba/easyexcel/assets/101182381/b9ce2fa4-5583-4bf3-9506-c14a6e1222a7">
<img width="911" alt="微信图片_20240418142515" src="https://github.com/alibaba/easyexcel/assets/101182381/59444845-dfb5-4f69-8959-377f2135e997">
@hhjsmm hhjsmm added the bug Something isn't working label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants