This commit is contained in:
lxyer 2020-04-27 22:44:22 +08:00
parent b083db50ac
commit a667e888f0
5 changed files with 32 additions and 26 deletions

View File

@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.lxyer</groupId> <groupId>net.tccn</groupId>
<artifactId>excel</artifactId> <artifactId>excel</artifactId>
<version>0.1.1</version> <version>0.1.1</version>
<packaging>jar</packaging> <packaging>jar</packaging>
@ -40,8 +40,8 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<configuration> <configuration>
<source>1.8</source> <source>14</source>
<target>1.8</target> <target>14</target>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>

View File

@ -51,7 +51,7 @@ public class ExcelKit {
* @date 2015-6-16 下午5:56:56 * @date 2015-6-16 下午5:56:56
*/ */
//map:data,sheetName,hds,hdNames, //map:data,sheetName,hds,hdNames,
public static <T> Workbook exportExcels(List<Map<String, Object>> list) { public static <T> Workbook exportExcels(List<Map> list) {
Workbook wb = new SXSSFWorkbook(); //创建工作薄 Workbook wb = new SXSSFWorkbook(); //创建工作薄
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {

View File

@ -1,10 +1,13 @@
package com.lxyer.excel; package net.tccn.excel.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 org.junit.Test;
import java.io.*; import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.util.*; import java.util.*;
import static java.util.Arrays.asList; import static java.util.Arrays.asList;
@ -88,6 +91,7 @@ public class ExcelKitTest {
//--------------------------- 通用导入案例 -------------------------------- //--------------------------- 通用导入案例 --------------------------------
static Properties properties = new Properties(); static Properties properties = new Properties();
static { static {
try { try {
// 读取导入配置文件 // 读取导入配置文件
@ -99,6 +103,7 @@ public class ExcelKitTest {
/** /**
* 构建入库语句 * 构建入库语句
*
* @param list 数据list<Map> * @param list 数据list<Map>
* @param heads 数据库需要入库的字段 * @param heads 数据库需要入库的字段
* @param table 实体表 * @param table 实体表

View File

@ -1,11 +1,12 @@
package com.lxyer.excel; package net.tccn.excel.test;
import net.tccn.kit.poi.ExcelExportKit; import net.tccn.kit.poi.ExcelExportKit;
import net.tccn.kit.poi.ExcelKit;
import org.apache.poi.ss.usermodel.Workbook;
import org.junit.Test; import org.junit.Test;
import java.io.*; import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.*; import java.util.*;
import java.util.function.BiFunction; import java.util.function.BiFunction;
@ -13,8 +14,6 @@ import java.util.function.Function;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
import static java.util.Arrays.asList;
/** /**
* 以下均为非poi导出使用示例 * 以下均为非poi导出使用示例
* 1导出List<javabean>示例 * 1导出List<javabean>示例
@ -22,7 +21,7 @@ import static java.util.Arrays.asList;
* 3javax.servlet web项目中开发使用示例 * 3javax.servlet web项目中开发使用示例
* 4导出压缩的excel示例 * 4导出压缩的excel示例
* 5redkale web项目导出示例 * 5redkale web项目导出示例
* * <p>
* Created by liangxianyou at 2018/7/6 10:29. * Created by liangxianyou at 2018/7/6 10:29.
*/ */
public class ExportKitTest { public class ExportKitTest {
@ -128,6 +127,7 @@ public class ExportKitTest {
/** /**
* 4导出压缩的excel示例 * 4导出压缩的excel示例
*
* @param head * @param head
* @param rows * @param rows
* @param file * @param file
@ -153,6 +153,7 @@ public class ExportKitTest {
/** /**
* 5redkale web项目导出示例 * 5redkale web项目导出示例
*
* @return * @return
* @throws IOException * @throws IOException
*/ */
@ -167,7 +168,6 @@ 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();
@ -227,6 +227,7 @@ public class ExportKitTest {
/** /**
* 对象属性处理 * 对象属性处理
*
* @param o * @param o
* @param function * @param function
* @auther lxyer * @auther lxyer

View File

@ -1,4 +1,4 @@
package com.lxyer.excel; package net.tccn.excel.test;
import java.util.Date; import java.util.Date;