Browse Source

update

developing
jipengfei.jpf 7 years ago
parent
commit
15745fac34
  1. 170
      pom.xml
  2. 2
      src/main/java/com/alibaba/excel/ExcelReader.java
  3. 7
      src/main/java/com/alibaba/excel/ExcelWriter.java
  4. 8
      src/main/java/com/alibaba/excel/analysis/ExcelAnalyser.java
  5. 2
      src/main/java/com/alibaba/excel/analysis/SaxAnalyserV07.java
  6. 2
      src/main/java/com/alibaba/excel/analysis/v07/RowHandler.java
  7. 2
      src/main/java/com/alibaba/excel/analysis/v07/XMLTempFile.java
  8. 2
      src/main/java/com/alibaba/excel/analysis/v07/XmlParserFactory.java
  9. 6
      src/main/java/com/alibaba/excel/annotation/ExcelColumnNum.java
  10. 6
      src/main/java/com/alibaba/excel/annotation/ExcelProperty.java
  11. 2
      src/main/java/com/alibaba/excel/annotation/FieldType.java
  12. 2
      src/main/java/com/alibaba/excel/constant/ExcelXmlConstants.java
  13. 29
      src/main/java/com/alibaba/excel/context/AnalysisContext.java
  14. 12
      src/main/java/com/alibaba/excel/context/GenerateContext.java
  15. 2
      src/main/java/com/alibaba/excel/event/AnalysisEventListener.java
  16. 6
      src/main/java/com/alibaba/excel/event/AnalysisEventRegisterCenter.java
  17. 1
      src/main/java/com/alibaba/excel/event/OneRowAnalysisFinishEvent.java
  18. 1
      src/main/java/com/alibaba/excel/metadata/CellRange.java
  19. 1
      src/main/java/com/alibaba/excel/metadata/ExcelColumnProperty.java
  20. 5
      src/main/java/com/alibaba/excel/metadata/ExcelHeadProperty.java
  21. 1
      src/main/java/com/alibaba/excel/metadata/Font.java
  22. 1
      src/main/java/com/alibaba/excel/metadata/Table.java
  23. 1
      src/main/java/com/alibaba/excel/metadata/TableStyle.java
  24. 1
      src/main/java/com/alibaba/excel/parameter/ExcelWriteParam.java
  25. 2
      src/main/java/com/alibaba/excel/util/EasyExcelTempFile.java
  26. 1
      src/main/java/com/alibaba/excel/util/FileUtil.java
  27. 1
      src/main/java/com/alibaba/excel/util/IndexValueConverter.java
  28. 1
      src/main/java/com/alibaba/excel/util/PositionUtils.java
  29. 1
      src/main/java/com/alibaba/excel/util/TypeUtil.java
  30. 6
      src/main/java/com/alibaba/excel/write/ExcelBuilder.java
  31. 1
      src/main/java/com/alibaba/excel/write/ExcelBuilderImpl.java

170
pom.xml

@ -1,16 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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>
<parent>
<groupId>com.alibaba</groupId>
<artifactId>a2m.china</artifactId>
<version>3</version>
</parent>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>1.0.0-RELEASE</version>
<version>1.0.0</version>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
<packaging>jar</packaging>
<name>easyexcel</name>
<description>easyexcel is a excel handle tools written in Java</description>
<url>https://github.com/alibaba/easyexcel</url>
<inceptionYear>2018</inceptionYear>
<properties>
<junit.version>4.12</junit.version>
<gpg.skip>true</gpg.skip>
<javadoc.skip>false</javadoc.skip>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jdk.version>1.7</jdk.version>
</properties>
<scm>
<url>https://github.com/alibaba/easyexcel</url>
<connection>scm:git:https://git@github.com/alibaba/easyexcel.git</connection>
</scm>
<repositories>
<repository>
<id>local-file</id>
<url>file://${basedir}/lib/</url>
<layout>default</layout>
</repository>
</repositories>
<organization>
<name>Alibaba Group</name>
<url>https://github.com/alibaba</url>
</organization>
<developers>
<developer>
<id>jipengfei</id>
<name>jipengfei</name>
<email>1558143046@qq.com</email>
</developer>
</developers>
<licenses>
<license>
<name>Apache 2</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
<comments>A business-friendly OSS license</comments>
</license>
</licenses>
<dependencies>
<dependency>
@ -40,4 +88,110 @@
<version>1.14</version>
</dependency>
</dependencies>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav</artifactId>
<version>1.0-beta-2</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<encoding>UTF-8</encoding>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-javac</artifactId>
<version>2.7</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
<configuration>
<attach>true</attach>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/bvt/**/*.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadoc</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<skip>${javadoc.skip}</skip>
<show>public</show>
<charset>UTF-8</charset>
<encoding>UTF-8</encoding>
<docencoding>UTF-8</docencoding>
<links>
<link>http://docs.oracle.com/javase/6/docs/api</link>
</links>
</configuration>
</plugin>
<plugin>
<artifactId>maven-gpg-plugin</artifactId>
<configuration>
<skip>${gpg.skip}</skip>
</configuration>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>oss</id>
<name>jipengfei</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
<snapshotRepository>
<id>oss</id>
<name>jipengfei</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
</project>

2
src/main/java/com/alibaba/excel/ExcelReader.java

@ -67,7 +67,7 @@ public class ExcelReader {
/**
* 读取excel中包含哪些sheet
*
* @return
* @return Sheets
*/
public List<Sheet> getSheets() {
return analyser.getSheets();

7
src/main/java/com/alibaba/excel/ExcelWriter.java

@ -34,6 +34,7 @@ public class ExcelWriter {
*
* @param outputStream 文件输出流
* @param typeEnum 输出文件类型03或07强烈建议使用07版可以输出超大excel而不内存溢出
* @param needHead 是否需要表头
*/
public ExcelWriter(OutputStream outputStream, ExcelTypeEnum typeEnum, boolean needHead) {
excelBuilder = new ExcelBuilderImpl();
@ -55,7 +56,7 @@ public class ExcelWriter {
/**
* 生成多sheet,每个sheet一张表
*
* @param data List<String>代表一行数据
* @param data List代表一行数据
* @param sheet data写入某个sheet
* @return this当前引用
*/
@ -67,7 +68,7 @@ public class ExcelWriter {
/**
* 可生成多sheet,每个sheet多张表
*
* @param data type is <? extends BaseRowModel> 一个java模型一行数据
* @param data type 一个java模型一行数据
* @param sheet data写入某个sheet
* @param table data写入某个table
* @return this当前引用
@ -80,7 +81,7 @@ public class ExcelWriter {
/**
* 可生成多sheet,每个sheet多张表
*
* @param data List<String> 代表一行数据
* @param data List 代表一行数据
* @param sheet data写入某个sheet
* @param table data写入某个table
* @return this当前引用

8
src/main/java/com/alibaba/excel/analysis/ExcelAnalyser.java

@ -21,7 +21,7 @@ public interface ExcelAnalyser {
* @param excelTypeEnum 解析文件类型
* @param custom 用户自定义参数用户回调时候可以获取到
* @param eventListener 解析器需要的监听器
* @param trim
* @param trim 是否去空格
*/
void init(InputStream inputStream, ExcelTypeEnum excelTypeEnum, Object custom, AnalysisEventListener eventListener,
boolean trim);
@ -29,21 +29,21 @@ public interface ExcelAnalyser {
/**
* 解析指定sheet,{@link AnalysisEventListener}监听中使用
*
* @param sheetParam
* @param sheetParam 入参
*/
void analysis(Sheet sheetParam);
/**
*
* 默认解析第一个sheet解析结果以List<String> 的格式 {@link AnalysisEventListener}监听中使用
* 默认解析第一个sheet解析结果在 {@link AnalysisEventListener}监听中使用
*/
void analysis();
/**
* 返回excel中包含哪些sheet
*
* @return
* @return 返回所有sheet
*/
List<Sheet> getSheets();

2
src/main/java/com/alibaba/excel/analysis/SaxAnalyserV07.java

@ -33,7 +33,7 @@ import org.xml.sax.helpers.DefaultHandler;
/**
* @author jipengfei
* @date 2017/08/27
*
*/
public class SaxAnalyserV07 extends BaseSaxAnalyser {

2
src/main/java/com/alibaba/excel/analysis/v07/RowHandler.java

@ -23,7 +23,7 @@ import static com.alibaba.excel.constant.ExcelXmlConstants.ROW_TAG;
/**
* @author jipengfei
* @date 2017/08/23
*
*/
public class RowHandler extends DefaultHandler {

2
src/main/java/com/alibaba/excel/analysis/v07/XMLTempFile.java

@ -7,7 +7,7 @@ import com.alibaba.excel.util.EasyExcelTempFile;
/**
* @author jipengfei
* @date 2017/10/13
*
*/
public class XMLTempFile {

2
src/main/java/com/alibaba/excel/analysis/v07/XmlParserFactory.java

@ -14,7 +14,7 @@ import org.xml.sax.XMLReader;
/**
* @author jipengfei
* @date 2017/10/13
*
*/
public class XmlParserFactory {

6
src/main/java/com/alibaba/excel/annotation/ExcelColumnNum.java

@ -11,7 +11,7 @@ import java.lang.annotation.Target;
* Field column num at excel head
*
* @author jipengfei
* @date 2017/03/19
*
*/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
@ -20,7 +20,7 @@ public @interface ExcelColumnNum {
/**
* col num
* @return
* @return col num
*/
int value();
@ -29,7 +29,7 @@ public @interface ExcelColumnNum {
* Default @see com.alibaba.TypeUtil
* if default is not meet you can set format
*
* @return
* @return format
*/
String format() default "";
}

6
src/main/java/com/alibaba/excel/annotation/ExcelProperty.java

@ -16,14 +16,14 @@ public @interface ExcelProperty {
/**
* 某列表头值
* @return
* @return 表头值
*/
String[] value() default {""};
/**
* 列顺序越小越靠前
* @return
* @return 列顺序
*/
int index() default 99999;
@ -32,7 +32,7 @@ public @interface ExcelProperty {
* default @see com.alibaba.TypeUtil
* if default is not meet you can set format
*
* @return
* @return 日期格式化
*/
String format() default "";
}

2
src/main/java/com/alibaba/excel/annotation/FieldType.java

@ -3,7 +3,7 @@ package com.alibaba.excel.annotation;
/**
*
* @author jipengfei
* @date 2017/03/15
*
*/
public enum FieldType {

2
src/main/java/com/alibaba/excel/constant/ExcelXmlConstants.java

@ -2,7 +2,7 @@ package com.alibaba.excel.constant;
/**
* @author jipengfei
* @date 2017/08/24
*
*/
public class ExcelXmlConstants {
public static final String DIMENSION = "dimension";

29
src/main/java/com/alibaba/excel/context/AnalysisContext.java

@ -33,7 +33,7 @@ public interface AnalysisContext {
/**
* 设置当前解析的Sheet
*
* @param sheet
* @param sheet 入参
*/
void setCurrentSheet(Sheet sheet);
@ -54,28 +54,28 @@ public interface AnalysisContext {
/**
* 获取当前监听者
*
* @return
* @return listener
*/
AnalysisEventListener getEventListener();
/**
* 获取当前行数
*
* @return
* @return 当前行
*/
Integer getCurrentRowNum();
/**
* 设置当前行数
*
* @param row
* @param row 设置行号
*/
void setCurrentRowNum(Integer row);
/**
* 返回当前sheet共有多少行数据仅限07版excel
*
* @return
* @return 总行数
*/
@Deprecated
Integer getTotalCount();
@ -83,57 +83,58 @@ public interface AnalysisContext {
/**
* 设置总条数
*
* @param totalCount
* @param totalCount 总行数
*/
void setTotalCount(Integer totalCount);
/**
* 返回表头信息
*
* @return
* @return 表头信息
*/
ExcelHeadProperty getExcelHeadProperty();
/**
* 构建 ExcelHeadProperty
*
* @param clazz
* @param headOneRow
* @param clazz 自定义model
* @param headOneRow 表头内容
*/
void buildExcelHeadProperty(Class<? extends BaseRowModel> clazz, List<String> headOneRow);
/**
* 是否trim()
*
* @return
* @return 是否trim
*/
boolean trim();
/**
*
* @param result 解析结果
*/
void setCurrentRowAnalysisResult(Object result);
/**
*
* @return 当前行解析结果
*/
Object getCurrentRowAnalysisResult();
/**
*
* 中断
*/
void interrupt();
/**
*
* @return
* @return 是否use1904WindowDate
*/
boolean use1904WindowDate();
/**
*
* @param use1904WindowDate
* @param use1904WindowDate 是否use1904WindowDate
*/
void setUse1904WindowDate(boolean use1904WindowDate);
}

12
src/main/java/com/alibaba/excel/context/GenerateContext.java

@ -24,26 +24,26 @@ public interface GenerateContext {
/**
*
* 获取表头样式
* @return
* @return 当前行表头样式
*/
CellStyle getCurrentHeadCellStyle();
/**
* 获取内容样式
* @return
* @return 当前行内容样式
*/
CellStyle getCurrentContentStyle();
/**
* 返回WorkBook
* @return
* @return 返回文件book
*/
Workbook getWorkbook();
/**
* 返回Io流
* @return
* @return 返回out流
*/
OutputStream getOutputStream();
@ -61,13 +61,13 @@ public interface GenerateContext {
/**
* 返回表头信息
* @return
* @return 返回表头信息
*/
ExcelHeadProperty getExcelHeadProperty();
/**
*
* @return
* @return 是否需要表头
*/
boolean needHead();
}

2
src/main/java/com/alibaba/excel/event/AnalysisEventListener.java

@ -24,7 +24,7 @@ public abstract class AnalysisEventListener<T> {
/**
* if have something to do after all analysis
*
* @param context
* @param context context
*/
public abstract void doAfterAllAnalysed(AnalysisContext context);
}

6
src/main/java/com/alibaba/excel/event/AnalysisEventRegisterCenter.java

@ -10,15 +10,15 @@ public interface AnalysisEventRegisterCenter {
/**
* 增加监听者
* @param name
* @param listener
* @param name 名称
* @param listener 监听器
*/
void appendLister(String name, AnalysisEventListener listener);
/**
* 通知所有监听者
* @param event
* @param event 事件
*/
void notifyListeners(OneRowAnalysisFinishEvent event);

1
src/main/java/com/alibaba/excel/event/OneRowAnalysisFinishEvent.java

@ -2,7 +2,6 @@ package com.alibaba.excel.event;
/**
* @author jipengfei
* @date 2017/07/21
*/
public class OneRowAnalysisFinishEvent {

1
src/main/java/com/alibaba/excel/metadata/CellRange.java

@ -2,7 +2,6 @@ package com.alibaba.excel.metadata;
/**
* @author jipengfei
* @date 2017/06/02
*/
public class CellRange {

1
src/main/java/com/alibaba/excel/metadata/ExcelColumnProperty.java

@ -6,7 +6,6 @@ import java.util.List;
/**
* @author jipengfei
* @date 2017/05/31
*/
public class ExcelColumnProperty implements Comparable<ExcelColumnProperty> {

5
src/main/java/com/alibaba/excel/metadata/ExcelHeadProperty.java

@ -15,7 +15,6 @@ import com.alibaba.excel.annotation.ExcelProperty;
* 表头信息
*
* @author jipengfei
* @date 2017/05/31
*/
public class ExcelHeadProperty {
@ -120,8 +119,8 @@ public class ExcelHeadProperty {
/**
* 根据Excel中的列号获取Excel的表头信息
*
* @param columnNum
* @return
* @param columnNum 列号
* @return ExcelColumnProperty
*/
public ExcelColumnProperty getExcelColumnProperty(int columnNum) {
ExcelColumnProperty excelColumnProperty = excelColumnPropertyMap1.get(columnNum);

1
src/main/java/com/alibaba/excel/metadata/Font.java

@ -4,7 +4,6 @@ package com.alibaba.excel.metadata;
* 字体样式
*
* @author jipengfei
* @date 2017/05/24
*/
public class Font {

1
src/main/java/com/alibaba/excel/metadata/Table.java

@ -4,7 +4,6 @@ import java.util.List;
/**
* @author jipengfei
* @date 2017/05/16
*/
public class Table {
/**

1
src/main/java/com/alibaba/excel/metadata/TableStyle.java

@ -4,7 +4,6 @@ import org.apache.poi.ss.usermodel.IndexedColors;
/**
* @author jipengfei
* @date 2017/05/24
*/
public class TableStyle {

1
src/main/java/com/alibaba/excel/parameter/ExcelWriteParam.java

@ -8,7 +8,6 @@ import com.alibaba.excel.support.ExcelTypeEnum;
* 为方便使用废弃该入参直接将outputStreamtype传入{@link com.alibaba.excel.ExcelWriter}的构造器即可
*
* @author jipengfei
* @date 2017/05/15
*/
@Deprecated
public class ExcelWriteParam {

2
src/main/java/com/alibaba/excel/util/EasyExcelTempFile.java

@ -6,7 +6,6 @@ import java.io.File;
* 用于修复POI {@link org.apache.poi.util.DefaultTempFileCreationStrategy}在并发写创建临时目录抛出异常的BUG
*
* @author jipengfei
* @date 2017/06/22
*/
public class EasyExcelTempFile {
@ -35,6 +34,7 @@ public class EasyExcelTempFile {
/**
* 获取环境变量的配置
* @return easyexcel临时目录
*/
public static String getEasyExcelTmpDir() {
String tmpDir = System.getProperty(JAVA_IO_TMPDIR);

1
src/main/java/com/alibaba/excel/util/FileUtil.java

@ -14,7 +14,6 @@ import org.apache.commons.compress.utils.IOUtils;
/**
* @author jipengfei
* @date 2017/10/10
*/
public class FileUtil {

1
src/main/java/com/alibaba/excel/util/IndexValueConverter.java

@ -9,7 +9,6 @@ import com.alibaba.excel.metadata.IndexValue;
/**
* 去除空Cell
* @author jipengfei
* @date 2017/04/13
*/
public class IndexValueConverter {
public static List<String> converter(List<IndexValue> i_list) {

1
src/main/java/com/alibaba/excel/util/PositionUtils.java

@ -2,7 +2,6 @@ package com.alibaba.excel.util;
/**
* @author jipengfei
* @date 2017/08/27
*/
public class PositionUtils {

1
src/main/java/com/alibaba/excel/util/TypeUtil.java

@ -16,7 +16,6 @@ import org.apache.poi.hssf.usermodel.HSSFDateUtil;
* 类型转换工具类
*
* @author jipengfei
* @date 2017/03/15
*/
public class TypeUtil {

6
src/main/java/com/alibaba/excel/write/ExcelBuilder.java

@ -26,14 +26,14 @@ public interface ExcelBuilder {
/**
* 向Excel增加的内容
*
* @param data 数据格式 {@link List < String >} {@link List <? extends com.alibaba.excel.metadata.BaseRowModel>}
* @param data 数据格式
*/
void addContent(List data);
/**
* 向Excel增加的内容
*
* @param data 数据格式 {@link List < String >} {@link List <? extends com.alibaba.excel.metadata.BaseRowModel>}
* @param data 数据格式
* @param sheetParam 数据写到某个sheet中
*/
void addContent(List data, Sheet sheetParam);
@ -41,7 +41,7 @@ public interface ExcelBuilder {
/**
* 向Excel增加的内容
*
* @param data 数据格式 {@link List < String >} {@link List <? extends com.alibaba.excel.metadata.BaseRowModel>}
* @param data 数据格式
* @param sheetParam 数据写到某个sheet中
* @param table 写到某个sheet的某个Table
*/

1
src/main/java/com/alibaba/excel/write/ExcelBuilderImpl.java

@ -18,7 +18,6 @@ import org.apache.poi.ss.usermodel.Row;
/**
* @author jipengfei
* @date 2017/05/27
*/
public class ExcelBuilderImpl implements ExcelBuilder {

Loading…
Cancel
Save