All Projects → MatrixSeven → ExcelReads

MatrixSeven / ExcelReads

Licence: Apache-2.0 License
ExcelReads(简单Excel通用读写器)

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to ExcelReads

abap2xlsx
Generate your professional Excel spreadsheet from ABAP
Stars: ✭ 493 (+971.74%)
Mutual labels:  excel, excelreader, excelwriter
Php Ext Xlswriter
🚀 PHP Extension for creating and reader XLSX files.
Stars: ✭ 1,734 (+3669.57%)
Mutual labels:  excel, excelwriter
Poi Android
📈 Apache POI for Android
Stars: ✭ 77 (+67.39%)
Mutual labels:  excel, poi
ExcelUtil
Excel utility for Java to read and write data in declarative way.
Stars: ✭ 27 (-41.3%)
Mutual labels:  excel, poi
Excel Boot
Easy-POI是一款Excel导入导出解决方案组成的轻量级开源组件。
Stars: ✭ 347 (+654.35%)
Mutual labels:  excel, poi
Easyexcel
快速、简单避免OOM的java处理Excel工具
Stars: ✭ 22,133 (+48015.22%)
Mutual labels:  excel, poi
Autopoi
AutoPOI 功能如同名字auto,追求的就是自动化,让一个没接触过poi的人员,可以傻瓜化的快速实现Excel导入导出、Word模板导出、可以仅仅5行代码就可以完成Excel的导入导出。
Stars: ✭ 213 (+363.04%)
Mutual labels:  excel, poi
excel2xx
导出 Excel 到结构化数据或代码 ( lua, c/c++, go 等等由你的 mako 模板决定 )
Stars: ✭ 14 (-69.57%)
Mutual labels:  excel, excelreader
refinery
Refinery is a tool to extract and transform semi-structured data from Excel spreadsheets of different layouts in a declarative way.
Stars: ✭ 30 (-34.78%)
Mutual labels:  excel, poi
simple-excel
Generate excel sheets in Java
Stars: ✭ 85 (+84.78%)
Mutual labels:  excel, poi
Poi
☀️ Read and Write Excel file using Java and Apache POI
Stars: ✭ 321 (+597.83%)
Mutual labels:  excel, poi
excel2javabeans
convert excel rows to javabeans and vice visa
Stars: ✭ 16 (-65.22%)
Mutual labels:  excel, poi
Excel4j
✨ Excel operation component based on poi & CSV ✨
Stars: ✭ 305 (+563.04%)
Mutual labels:  excel, poi
Myexcel
MyExcel, a new way to operate excel!
Stars: ✭ 1,198 (+2504.35%)
Mutual labels:  excel, poi
Poiji
🍬 A tiny library converting excel rows to a list of Java objects based on Apache POI
Stars: ✭ 255 (+454.35%)
Mutual labels:  excel, poi
Hy.common.report
报表、Excel操作类库。Java转Excel、Excel转Java
Stars: ✭ 124 (+169.57%)
Mutual labels:  excel, poi
goxlsxwriter
Golang bindings for libxlsxwriter for writing XLSX files
Stars: ✭ 18 (-60.87%)
Mutual labels:  excel, excelwriter
poi-mapper
Model to Excel, Excel to Model mapper based on apache poi, java reflection
Stars: ✭ 13 (-71.74%)
Mutual labels:  excel, poi
xlsx-reader
xlsx-reader is a PHP library for fast and efficient reading of XLSX spreadsheet files. Its focus is on reading the data contained within XLSX files, disregarding all document styling beyond that which is strictly necessary for data type recognition. It is built to be usable for very big XLSX files in the magnitude of multiple GBs.
Stars: ✭ 40 (-13.04%)
Mutual labels:  excel, excelreader
hadoopoffice
HadoopOffice - Analyze Office documents using the Hadoop ecosystem (Spark/Flink/Hive)
Stars: ✭ 56 (+21.74%)
Mutual labels:  excel, poi

ExcelReads(简单Excel通用读写器)

Apache License, Version 2.0, January 2004 Jenkins Status last_release language

ExcelReads是什么?

  • 这是一个通用的简单的Excel读取器
  • 支持自定义JavaBean实体读取和HashMap自动读取
  • 支持自定义扩展
  • 支持自定义Sheet范围,数据开始行数
  • 支持数据库查询直接导出Excel(Map/Object)
  • 支持正则过滤数据格式
  • JavaBean实体支持使用注解添加正则规则校验,HashMap支持数组规则校验
  • 依赖POI,使用Maven构建

在项目的pom文件增加下面内容,即可食用! Enjoy it!!!

<dependency>
  <groupId>com.github.matrixseven</groupId>
  <artifactId>ExcelReads</artifactId>
  <version>1.0.4</version>
</dependency>


更新日志详见:UpdateLogs.md

最近三次更新:

更新2019/12/2 

  • 替换导出方式
  • 增加 Create/CreateLoop[Map|Obj]
  • 更新顶层接口

更新2019/4/26 (诈尸更新)

  • 更加完善的类型推导,书写更方便(Great!!!)
  • 修复增加过滤列无法读取数据bug
  • 替换一些接口为Java8内置接口
  • 更流畅优雅的调用方法
  • 标注一些不建议使用的类/方法/属性

更新2017/01/11

  • 增加AnyCol来对应FilterCol方法,只保留AnyCol类列
  • 增加SetCellStyle,突破CellStyle绑定wk约束,链式设置列单元格风格(非常狗血)

其他

  • 自定义读取支持出简单的规范化数据格式,即典型的表头格式
  • 可以继承 WapperMap 和 WapperObj进行扩展
  • 直接使用ExcelFactory.getBeans进行获取,WapperObj则自己添加泛型
  • 注解Value对应列标题,Required对应正则,可自己写正则表达式或者直接使用RegHelper
  • 实体bean数据要比hashMap慢,7w条数据慢800ms,加入正则减慢速度(测试中加入了正则)

使用方法说明

  1. 本程序只能读取简单格式的xls/xlsx文件,文件布局如下(标准的行列结构):
标题1 标题2 标题3
foo foo foo
bar bar bar
baz baz baz

读取Excel

  • 喜大若奔(。・・)ノ Filter/Sort等lambda操作不用在声明类型(还是要写一个泛型)
    //CreateMapLoop 多sheet|isLoopSheet
    Map<String, Map<String, String>> maps = ExcelFactory.getMaps(filePath, it -> it.vocSize(1999)
            .title(2)
            .content(3)
            .isLoopSheet(true))
            .Filter(it -> it.get("在线人数").equals("43"))
            .CreateMapLoop();
    //CreateMap 单个
    List<Map<String, String>> maps2 = ExcelFactory.getMaps(filePath, it -> it.vocSize(1999)
            .title(2)
            .content(3))
            .Filter(it -> it.get("在线人数").equals("43"))
            .CreateMap();
    //Create Obj
    List<B> create = ExcelFactory.<B>getBeans(B.class, filePath, it -> it.title(2)
            .content(3)).Create();
    //CreateObjLoop
    String filePath2 = System.getProperty("user.dir").concat("/seven.xlsx");
    Map<String, List<A>> stringListMap = ExcelFactory.<A>getBeans(A.class, filePath2,
            it -> it.withConvert("姓名", ConvertTest.class)
                    .isLoopSheet(true)
                    .withConvert("姓名", f -> f.toString().concat("111111111")))
            .Process(a -> a.setA(a.getA() + "fuck"))
            .CreateObjLoop();

数据库导出自定义Bean类型写法(xxx.Class类型)

Result data=UNPOOLED_DATA_SOURCE.getConnection().prepareStatement("select * FROM  users_info limit 1000").executeQuery()
ExcelFactory.saveExcel(data,filePath,AS.class)
    .Filter(o->o.getA().length() > 3)
    .Flush();
    
  //ConvertName 转行列名  
ExcelFactory.saveExcel(ps.executeQuery()).SetPath("seven.xlsx")
    .Process(it->it.put("address",it.get("address").concat("seven")))
    .SetCellStyle("A", cellStyle -> cellStyle
                            .setFillPattern(FillPatternType.DIAMONDS)
                            .setAlignment(HorizontalAlignment.RIGHT)
                            .setFillForegroundColor(HSSFColor.WHITE.index)
                            .setBottomBorderColor(HSSFColor.RED.index)
                            .setFillBackgroundColor(HSSFColor.GOLD.index)
                            .setRightBorderColor(HSSFColor.INDIGO.index))
    .ConvertName("address","地址")
    .ConvertName("name","姓名")
    .Flush();

效果

ExcelReads

实体类截图

ExcelReads

继承关系

ExcelReads

引用关系

ExcelReads

写入效果

ExcelReads

Acknowledgement

!特别感谢 JetBrains 为开源项目提供免费的 IntelliJ IDEA 等 IDE 的授权

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].