alibaba / easyexcel

快速、简洁、解决大文件内存溢出的java处理Excel工具
https://easyexcel.opensource.alibaba.com
Apache License 2.0
32.35k stars 7.52k forks source link

无法读取excel表头数据 #650

Closed zgc824 closed 5 years ago

zgc824 commented 5 years ago

异常代码

   ExcelListener excelListener = new ExcelListener();
   excelReader = EasyExcel.read(in,null,excelListener).build();
   excelReader.read();

   AnalysisEventListener的invoke方法如下:
   ReadSheetHolder readSheetHolder = analysisContext.readSheetHolder();
        String sheetName = readSheetHolder.getSheetName();
        if(Objects.isNull(o) || ((HashMap) o).size() == 0){
            return;
        }
        if(map.containsKey(sheetName)){
            map.get(sheetName).add(o);
        }else {
            List<Object> objectList = new ArrayList<>();
            objectList.add(o);
            map.put(sheetName,objectList);
        }

异常提示 无异常,解析的数据,对象o无表头中文数据 建议描述

zhuangjiaju commented 5 years ago

对象o 是什么?

zhangjingsen commented 5 years ago

EasyExcel.read(fileName, null, excelListener).sheet().headRowNumber(0).doRead(); 读的时候设置headRowNumber试试

sjmingdna commented 5 years ago

好的,谢谢

------------------ 原始邮件 ------------------ 发件人: "景森"notifications@github.com; 发送时间: 2019年9月29日(星期天) 下午3:29 收件人: "alibaba/easyexcel"easyexcel@noreply.github.com; 抄送: "Subscribed"subscribed@noreply.github.com; 主题: Re: [alibaba/easyexcel] 无法读取excel表头数据 (#650)

EasyExcel.read(fileName, null, excelListener).sheet().headRowNumber(0).doRead(); 读的时候设置headRowNumber试试

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

zgc824 commented 5 years ago

对象o就是invoke方法的的第一个入参

zgc824 commented 5 years ago

EasyExcel.read(in, null, excelListener).headRowNumber(0).build().read() 成功读取每个sheet页的数据