liuhuagui / gridexcel Goto Github PK
View Code? Open in Web Editor NEWUniversal solution for reading and writing simply Excel based on functional programming and POI EventModel
Universal solution for reading and writing simply Excel based on functional programming and POI EventModel
你好,我有个产品excel中有504103行数据,使用GridExcel.readByEventModel读取excel的时候,设置windowSize=100,读取完之后我的List集合只有504100条数据,少了3条数据。但是设置windowSize=1的时候是正常的。引用代码如下:
List list = new ArrayList<>();
GridExcel.readByEventModel(ins, ProductDTO.class, ExcelType.XLSX)
.window(100, list::addAll)
.process(cs ->{
ProductDTO dto = new ProductDTO();
dto.setCompanyId(cs.get(0));
dto.setProductName(cs.get(1));
dto.setProductNo(cs.get(2));
dto.setBasePrice(new BigDecimal(cs.get(4)));
return dto;
},1);
System.out.println(list.size());
望解答,谢谢!
sheet1和sheet2数据不同,如何支持分sheet判断导入?
你好,我想在分批读取数据的同时也把表头信息返回到。
因为我要读取的excel列数可能不固定,所以我需要读取表头的列有多少,按照工具提供的方法我找了一下貌似不可以?如果按照第一行开始取数据的话又无法按设定的数值来分批次读取,请问有什么建议吗
GridExcel.writeByStreaming(RoyaltyProject.class)
.head(headMapper())
.createSheet()
.process(list)
.write(response.getOutputStream());
你好,当list.size == 0 的时候,程序直接抛异常了,无法导出excel,有替换方案吗?
先检查数据,如果有问题能否马上跳出循环?
另外能否取得当前行号?
能否在标题栏下面定义一栏字段名称,然后自动匹配bean的字段?
我的sheet1一共5条数据, 其他2个sheet没有数据,输出只看到第1,3,5数据,2和4没有输出。不知为何,谢谢!
GridExcel.readByEventModel(resourceAsStream,Product.class, ExcelType.XLSX)
.window(2,ts ->
{
try{
System.out.println("sheet" + mapper.writeValueAsString(ts));
} catch (Exception e) {
e.printStackTrace();
}
})//推荐在这里执行自己的业务逻辑
.process(cs ->{
Product product = new Product();
product.setProductName(cs.get(0));
return product;
},1).get();
我有个excel模板,里面有空格
但是有的空格无法识别,有的空格又能识别,请问下是什么原因额
我可以把模板excel发给您看看
20200327071.xlsx
第2-5列,只能识别到2个空行出来。 不知道是什么原因
望回答,谢谢
当单元格数据为空时 process cs 是不会读取单元格为空的数据的 这就会导致返回的每一行的数据长短不一致 这就没法确定 读指定的某一列数据
比如我需要做送货单、发票格式的excel导出,支持合并单元格这些操作吗?还是需要自己去写一个模板类拼接?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.