easyexcel
easyexcel copied to clipboard
能否将本行数据给到converter和invoke方法?
建议描述
public interface Converter
...
T convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) throws Exception;
...
}
只给 celldata ,不够用啊
public interface ReadListener
void invoke(T data, AnalysisContext context);
...
}
有时候 并不能将 所有数据都转换到 T 中, 希望invoke中也加上 原始数据的 引用 ,把 Map<Integer, CellData> map ; 给到用户
使用场景是: 读取excel中的数据 有些列是固定的,有些是 动态添加的;
已经在开发了。CellData 能获取到 行号和列号。
好的 不过我在最新的版本上 , 自己加了 扩展方法 加在 ReadRowHolder 这个类上
**public Object getCurrentRowSrcResult() {
return currentRowSrcResult;
}
public void setCurrentRowSrcResult(Map<Integer, CellData> map) {
Map<Integer, CellData> cloneMap = new HashMap<Integer, CellData>(map.size());
for (Integer key : map.keySet()) {
cloneMap.put(key, map.get(key));
}
this.currentRowSrcResult = cloneMap;
}**