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

遇到一个奇怪的问题,解析一个xlsexcel 有的行解析成了2行 #4082

Open
zmueignleaigoeu opened this issue Jan 24, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@zmueignleaigoeu
Copy link

建议先去看文档

快速开始常见问题

触发场景描述

工作表.xls

Image

Image

Image

触发Bug的代码

DataListener listener = new DataListener ();
             EasyExcel.read(file.getInputStream(),listener)
                    .extraRead(CellExtraTypeEnum.MERGE)
                     .ignoreEmptyRow(false)
                    .sheet(index)
                    .headRowNumber(0)
                    .doRead();


@Slf4j
public class DataListener 

[工作表.xls](https://github.com/user-attachments/files/18534729/default.xls)

extends AnalysisEventListener<Map<Integer, String>> {
    private List<Map<Integer, String>> dataList = new ArrayList<>();

    private List<CellExtra> cellExtraList = new ArrayList<>();

    private Integer emptyRow = 0;
    @Override
    public void invoke(Map<Integer, String> data, AnalysisContext analysisContext) {
            dataList.add(data);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext context) {
    }
    
    @Override
    public void extra(CellExtra extra, AnalysisContext context) {
        switch (extra.getType()) {
            case MERGE:
                cellExtraList.add(extra);
                break;
            default:
        }
    }

    public List<Map<Integer, String>> getDataList() {
        return dataList;
    }

    public List<CellExtra> getCellExtraList() {
        return cellExtraList;
    }

    public void clear(){
        dataList.clear();
        cellExtraList.clear();
    }
}

提示的异常或者没有达到的效果

大家尽量把问题一次性描述清楚,然后贴上全部异常,这样方便把问题一次性解决掉。
至少大家要符合一个原则就是,能让其他人复现出这个问题,如果无法复现,肯定无法解决。

@zmueignleaigoeu zmueignleaigoeu added the bug Something isn't working label Jan 24, 2025
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