alibaba / easyexcel

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

如何在自定义Listener中读取外层参数 #1243

Closed leslie010203 closed 4 years ago

leslie010203 commented 4 years ago
   String paramConfigs = "2233";
        ExcelImportListener excelImportListener = new ExcelImportListener();
        ExcelReader build = EasyExcel.read(file.getInputStream()).build();
        List<ReadSheet> readSheets = build.excelExecutor().sheetList();
        //多sheet处理
        //1.参数传递
        for (ReadSheet readSheet : readSheets) {
            EasyExcel.read(file.getInputStream()).sheet(readSheet.getSheetNo()).doReadSync();
        }

如何在自定义监听中获取paramConfigs 这个参数呢

leslie010203 commented 4 years ago

晓得了

wangyuhuich commented 4 years ago

请问这个问题是如何解决的?

leslie010203 commented 4 years ago

在listener中定义变量,然后用到的时候set进去

------------------ 原始邮件 ------------------ 发件人: "王昱辉"<notifications@github.com>; 发送时间: 2020年6月16日(星期二) 上午9:02 收件人: "alibaba/easyexcel"<easyexcel@noreply.github.com>; 抄送: "超级美的吴大梦"<872263002@qq.com>;"State change"<state_change@noreply.github.com>; 主题: Re: [alibaba/easyexcel] 如何在自定义Listener中读取外层参数 (#1243)

请问这个问题是如何解决的?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

wangyuhuich commented 4 years ago

明白了,谢谢。 Map<String, Object> param= new HashMap<>(); ExcelReader reader = EasyExcel.read(file.getInputStream()).customObject(param).build();