.
This commit is contained in:
parent
4d3afd565e
commit
e141c8b96e
11
pom.xml
11
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>net.tccn</groupId>
|
<groupId>net.tccn</groupId>
|
||||||
<artifactId>excel</artifactId>
|
<artifactId>excel</artifactId>
|
||||||
<version>0.1.1</version>
|
<version>0.1.0</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -27,9 +27,7 @@
|
|||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<finalName>JExcel</finalName>
|
<finalName>excel-kit</finalName>
|
||||||
<sourceDirectory>src</sourceDirectory>
|
|
||||||
<testSourceDirectory>test</testSourceDirectory>
|
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
<directory>res</directory>
|
<directory>res</directory>
|
||||||
@ -39,9 +37,10 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.11.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>14</source>
|
<source>1.8</source>
|
||||||
<target>14</target>
|
<target>1.8</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
package net.tccn.excel.test;
|
package test;
|
||||||
|
|
||||||
import net.tccn.kit.poi.ExcelKit;
|
import net.tccn.kit.poi.ExcelKit;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
@ -17,7 +16,7 @@ import static java.util.Arrays.asList;
|
|||||||
*/
|
*/
|
||||||
public class ExcelKitTest {
|
public class ExcelKitTest {
|
||||||
|
|
||||||
@Test
|
//@Test
|
||||||
public void mapExport() {
|
public void mapExport() {
|
||||||
// 数据List<T> T可以是map,也可以是某个Javabean
|
// 数据List<T> T可以是map,也可以是某个Javabean
|
||||||
Map m1 = new HashMap();
|
Map m1 = new HashMap();
|
||||||
@ -49,7 +48,7 @@ public class ExcelKitTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//read excel by fields
|
//read excel by fields
|
||||||
@Test
|
//@Test
|
||||||
public void readTest() throws IOException {
|
public void readTest() throws IOException {
|
||||||
/*String sql1 = "select a, b, c from Sheet1";
|
/*String sql1 = "select a, b, c from Sheet1";
|
||||||
String sql2 = "select a, b, c from Sheet1 where a=1 order by b";
|
String sql2 = "select a, b, c from Sheet1 where a=1 order by b";
|
||||||
@ -75,7 +74,7 @@ public class ExcelKitTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//read excel no fields
|
//read excel no fields
|
||||||
@Test
|
//@Test
|
||||||
public void readTest2() throws IOException {
|
public void readTest2() throws IOException {
|
||||||
// 在不传 String[] fields 会把值从左到右分别赋值给 a...z,这样的key上
|
// 在不传 String[] fields 会把值从左到右分别赋值给 a...z,这样的key上
|
||||||
List<Map> list = ExcelKit.readExcel(new File("target/abx.xls"));
|
List<Map> list = ExcelKit.readExcel(new File("target/abx.xls"));
|
||||||
@ -137,7 +136,7 @@ public class ExcelKitTest {
|
|||||||
/**
|
/**
|
||||||
* 通用数据导入
|
* 通用数据导入
|
||||||
*/
|
*/
|
||||||
@Test
|
//@Test
|
||||||
public void importTest() {
|
public void importTest() {
|
||||||
String key = "user"; // 假定使用业务实体表名作为key
|
String key = "user"; // 假定使用业务实体表名作为key
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package net.tccn.excel.test;
|
package test;
|
||||||
|
|
||||||
import net.tccn.kit.poi.ExcelExportKit;
|
import net.tccn.kit.poi.ExcelExportKit;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -168,7 +168,7 @@ public class ExportKitTest {
|
|||||||
response.finish(buf.toString().getBytes());
|
response.finish(buf.toString().getBytes());
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@Test
|
//@Test
|
||||||
public void t() {
|
public void t() {
|
||||||
Object t = new Person();
|
Object t = new Person();
|
||||||
((Person) t).setAge(20);
|
((Person) t).setAge(20);
|
||||||
@ -206,7 +206,7 @@ public class ExportKitTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
//@Test
|
||||||
public void t2() {
|
public void t2() {
|
||||||
Person person = new Person();
|
Person person = new Person();
|
||||||
/*person.setName("dsafd''s'f");
|
/*person.setName("dsafd''s'f");
|
@ -1,4 +1,4 @@
|
|||||||
package net.tccn.excel.test;
|
package test;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user