Skip to content

Commit 7e7712c

Browse files
committed
支持xlsx增加Demo,完整的工程结构,具体更新请看更新记录
1 parent d2f7ad7 commit 7e7712c

18 files changed

Lines changed: 955 additions & 863 deletions

README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,36 @@
77
* 支持正则过滤数据格式
88
* JavaBean实体支持使用注解添加正则规则校验,HashMap支持数组规则校验
99
* 依赖POI,使用Maven构建
10+
## 更新纪录
11+
12+
### 更新2016/11/29
13+
* 增加CreateMap By Key
14+
* 去除无用泛型
15+
* 增加xlsx支持
1016

1117
### 更新2016/11/8
1218
* 支持数据过滤和处理是转换,基于事件模式
1319
* 更新为Build模式创建实例
1420
* 增加数据过滤、数据转换和数据排序回调接口
1521
* 采用链式set方式进行
1622

17-
### 更新2016/11/29
18-
* 增加CreateMap By Key
19-
* 去除无用泛型
20-
* 增加xlsx支持
23+
2124

2225
## 其他
2326
* 自定义读取支持出简单的规范化数据格式,即典型的表头格式
2427
* 可以继承 WapperMap 和 WapperObj进行扩展
2528
* 直接使用ExcelFactory.getBeans进行获取,WapperObj则自己添加泛型
2629
* 注解Value对应列标题,Required对应正则,可自己写正则表达式或者直接使用RegHelper
2730
* 实体bean数据要比hashMap慢,7w条数据慢800ms,加入正则减慢速度(测试中加入了正则)
28-
* 加在一起没有200行,就那么一写,勿喷。
2931

3032
## 使用方法说明
3133
1. 本程序只能读取简单格式的xls文件,文件布局如下(标准的行列结构):<br>
3234

33-
| 标题1| 标题2| 标题3|
34-
------|------|----
35-
foo | foo | foo
36-
bar | bar | bar
37-
baz | baz | baz
35+
| 标题1 | 标题2 | 标题3 |
36+
|:-----:|:-----:|:-----:|
37+
|foo | foo | foo |
38+
|bar | bar | bar |
39+
|baz | baz | baz |
3840

3941
## 效果
4042
![ExcelReadshua](效果.png)

pom.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,21 @@
66
<packaging>pom</packaging>
77
<version>0.0.1-SNAPSHOT</version>
88
<dependencies>
9-
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
109
<dependency>
1110
<groupId>org.apache.poi</groupId>
1211
<artifactId>poi</artifactId>
1312
<version>3.15</version>
1413
</dependency>
15-
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
1614
<dependency>
1715
<groupId>org.apache.poi</groupId>
1816
<artifactId>poi-ooxml</artifactId>
1917
<version>3.15</version>
2018
</dependency>
21-
<dependency>
19+
<dependency>
2220
<groupId>junit</groupId>
2321
<artifactId>junit</artifactId>
2422
<version>4.12</version>
25-
<scope>test</scope>
23+
<scope>test</scope>
2624
</dependency>
2725
</dependencies>
2826
<build>
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
1-
package seven;
2-
3-
import seven.wapperInt.Wrapper;
4-
import seven.wapperInt.wapperRef.WrapperObj;
5-
6-
7-
//=======================================================
8-
// .----.
9-
// _.'__ `.
10-
// .--(^)(^^)---/#\
11-
// .' @ /###\
12-
// : , #####
13-
// `-..__.-' _.-\###/
14-
// `;_: `"'
15-
// .'"""""`.
16-
// /, ya ,\\
17-
// //¹·Éñ±£ÓÓ \\
18-
// `-._______.-'
19-
// ___`. | .'___
20-
// (______|______)
21-
//=======================================================
22-
/**
23-
* @author Seven<p>
24-
* @date 2016Äê6ÔÂ4ÈÕ-ÏÂÎç4:08:19
25-
*/
26-
@SuppressWarnings("unchecked")
27-
public class ExcelFactory {
28-
29-
private ExcelFactory() {
30-
}
31-
32-
public static Wrapper getBeans(String FilePath, WrapperObj r) throws Exception {
33-
return r.init(FilePath);
34-
}
35-
36-
}
1+
package seven;
2+
3+
import seven.wapperInt.Wrapper;
4+
import seven.wapperInt.wapperRef.WrapperObj;
5+
6+
7+
//=======================================================
8+
// .----.
9+
// _.'__ `.
10+
// .--(^)(^^)---/#\
11+
// .' @ /###\
12+
// : , #####
13+
// `-..__.-' _.-\###/
14+
// `;_: `"'
15+
// .'"""""`.
16+
// /, ya ,\\
17+
// //¹·Éñ±£ÓÓ \\
18+
// `-._______.-'
19+
// ___`. | .'___
20+
// (______|______)
21+
//=======================================================
22+
/**
23+
* @author Seven<p>
24+
* @date 2016Äê6ÔÂ4ÈÕ-ÏÂÎç4:08:19
25+
*/
26+
@SuppressWarnings("unchecked")
27+
public class ExcelFactory {
28+
29+
private ExcelFactory() {
30+
}
31+
32+
public static Wrapper getBeans(String FilePath, WrapperObj r) throws Exception {
33+
return r.init(FilePath);
34+
}
35+
36+
}

0 commit comments

Comments
 (0)