diff --git a/.travis.yml b/.travis.yml index 60343c4e..8191cf3c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,4 +6,5 @@ cache: before_install: - chmod +x mvnw install: - - ./mvnw install -Dgpg.skip -B -V -Dmaven.test.skip=true \ No newline at end of file + - ./mvnw install -Dgpg.skip -B -V -Dmaven.test.skip=true + - ./mvnw javadoc:javadoc \ No newline at end of file diff --git a/README.md b/README.md index 17ce6190..e48cd83b 100644 --- a/README.md +++ b/README.md @@ -25,10 +25,10 @@ Java解析、生成Excel比较有名的框架有Apache poi、jxl。但他们都 com.alibaba easyexcel - 2.0.0 + 2.0.0-beta1 ``` -## 最新版本:2.0.0 +## 最新版本:2.0.0-beta1 ## 维护者 姬朋飞(玉霄) ## 快速开始 @@ -38,9 +38,9 @@ DEMO代码地址:[https://github.com/alibaba/easyexcel/blob/master/src/test/ja ```java /** * 最简单的读 - *
  • 1. 创建excel对应的实体对象 参照{@link DemoData} - *
  • 2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link DemoDataListener} - *
  • 3. 直接读即可 + *

    1. 创建excel对应的实体对象 参照{@link DemoData} + *

    2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link DemoDataListener} + *

    3. 直接读即可 */ @Test public void simpleRead() { @@ -55,8 +55,8 @@ DEMO代码地址:[https://github.com/alibaba/easyexcel/blob/master/src/test/ja ```java /** * 最简单的写 - *

  • 1. 创建excel对应的实体对象 参照{@link com.alibaba.easyexcel.test.demo.write.DemoData} - *
  • 2. 直接写即可 + *

    1. 创建excel对应的实体对象 参照{@link com.alibaba.easyexcel.test.demo.write.DemoData} + *

    2. 直接写即可 */ @Test public void simpleWrite() { @@ -72,9 +72,9 @@ DEMO代码地址:[https://github.com/alibaba/easyexcel/blob/master/src/test/ja ```java /** * 文件下载 - *

  • 1. 创建excel对应的实体对象 参照{@link DownloadData} - *
  • 2. 设置返回的 参数 - *
  • 3. 直接写,这里注意,finish的时候会自动关闭OutputStream,当然你外面再关闭流问题不大 + *

    1. 创建excel对应的实体对象 参照{@link DownloadData} + *

    2. 设置返回的 参数 + *

    3. 直接写,这里注意,finish的时候会自动关闭OutputStream,当然你外面再关闭流问题不大 */ @GetMapping("download") public void download(HttpServletResponse response) throws IOException { @@ -86,9 +86,9 @@ DEMO代码地址:[https://github.com/alibaba/easyexcel/blob/master/src/test/ja /** * 文件上传 - *

  • 1. 创建excel对应的实体对象 参照{@link UploadData} - *
  • 2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link UploadDataListener} - *
  • 3. 直接读即可 + *

    1. 创建excel对应的实体对象 参照{@link UploadData} + *

    2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link UploadDataListener} + *

    3. 直接读即可 */ @PostMapping("upload") @ResponseBody diff --git a/pom.xml b/pom.xml index 30049644..f85fd407 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.alibaba easyexcel - 2.0.0 + 2.0.0-beta1 jar easyexcel @@ -214,7 +214,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.9.1 + 3.1.0 attach-javadocs diff --git a/quickstart.md b/quickstart.md index 28b8bf30..b9a7d0db 100644 --- a/quickstart.md +++ b/quickstart.md @@ -78,9 +78,9 @@ public class DemoDataListener extends AnalysisEventListener { ```java /** * 最简单的读 - *

  • 1. 创建excel对应的实体对象 参照{@link DemoData} - *
  • 2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link DemoDataListener} - *
  • 3. 直接读即可 + *

    1. 创建excel对应的实体对象 参照{@link DemoData} + *

    2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link DemoDataListener} + *

    3. 直接读即可 */ @Test public void simpleRead() { @@ -127,9 +127,9 @@ public class IndexOrNameData { /** * 指定列的下标或者列名 * - *

  • 1. 创建excel对应的实体对象,并使用{@link ExcelProperty}注解. 参照{@link IndexOrNameData} - *
  • 2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link IndexOrNameDataListener} - *
  • 3. 直接读即可 + *

    1. 创建excel对应的实体对象,并使用{@link ExcelProperty}注解. 参照{@link IndexOrNameData} + *

    2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link IndexOrNameDataListener} + *

    3. 直接读即可 */ @Test public void indexOrNameRead() { @@ -150,9 +150,9 @@ public class IndexOrNameData { ```java /** * 读多个sheet,这里注意一个sheet不能读取多次,多次读取需要重新读取文件 - *

  • 1. 创建excel对应的实体对象 参照{@link DemoData} - *
  • 2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link DemoDataListener} - *
  • 3. 直接读即可 + *

    1. 创建excel对应的实体对象 参照{@link DemoData} + *

    2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link DemoDataListener} + *

    3. 直接读即可 */ @Test public void repeatedRead() { @@ -248,9 +248,9 @@ public class CustomStringStringConverter implements Converter { * 日期、数字或者自定义格式转换 *

    * 默认读的转换器{@link DefaultConverterLoader#loadDefaultReadConverter()} - *

  • 1. 创建excel对应的实体对象 参照{@link ConverterData}.里面可以使用注解{@link DateTimeFormat}、{@link NumberFormat}或者自定义注解 - *
  • 2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link ConverterDataListener} - *
  • 3. 直接读即可 + *

    1. 创建excel对应的实体对象 参照{@link ConverterData}.里面可以使用注解{@link DateTimeFormat}、{@link NumberFormat}或者自定义注解 + *

    2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link ConverterDataListener} + *

    3. 直接读即可 */ @Test public void converterRead() { @@ -277,9 +277,9 @@ public class CustomStringStringConverter implements Converter { /** * 多行头 * - *

  • 1. 创建excel对应的实体对象 参照{@link DemoData} - *
  • 2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link DemoDataListener} - *
  • 3. 设置headRowNumber参数,然后读。 这里要注意headRowNumber如果不指定, 会根据你传入的class的{@link ExcelProperty#value()}里面的表头的数量来决定行数, + *

    1. 创建excel对应的实体对象 参照{@link DemoData} + *

    2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link DemoDataListener} + *

    3. 设置headRowNumber参数,然后读。 这里要注意headRowNumber如果不指定, 会根据你传入的class的{@link ExcelProperty#value()}里面的表头的数量来决定行数, * 如果不传入class则默认为1.当然你指定了headRowNumber不管是否传入class都是以你传入的为准。 */ @Test @@ -335,9 +335,9 @@ DEMO代码地址:[https://github.com/alibaba/easyexcel/blob/master/src/test/ja ```java /** * 文件上传 - *

  • 1. 创建excel对应的实体对象 参照{@link UploadData} - *
  • 2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link UploadDataListener} - *
  • 3. 直接读即可 + *

    1. 创建excel对应的实体对象 参照{@link UploadData} + *

    2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link UploadDataListener} + *

    3. 直接读即可 */ @PostMapping("upload") @ResponseBody @@ -381,8 +381,8 @@ public class DemoData { ```java /** * 最简单的写 - *

  • 1. 创建excel对应的实体对象 参照{@link DemoData} - *
  • 2. 直接写即可 + *

    1. 创建excel对应的实体对象 参照{@link DemoData} + *

    2. 直接写即可 */ @Test public void simpleWrite() { @@ -425,9 +425,9 @@ public class IndexData { ```java /** * 指定写入的列 - *

  • 1. 创建excel对应的实体对象 参照{@link IndexData} - *
  • 2. 使用{@link ExcelProperty}注解指定写入的列 - *
  • 3. 直接写即可 + *

    1. 创建excel对应的实体对象 参照{@link IndexData} + *

    2. 使用{@link ExcelProperty}注解指定写入的列 + *

    3. 直接写即可 */ @Test public void indexWrite() { @@ -456,9 +456,9 @@ public class ComplexHeadData { ```java /** * 复杂头写入 - *

  • 1. 创建excel对应的实体对象 参照{@link ComplexHeadData} - *
  • 2. 使用{@link ExcelProperty}注解指定复杂的头 - *
  • 3. 直接写即可 + *

    1. 创建excel对应的实体对象 参照{@link ComplexHeadData} + *

    2. 使用{@link ExcelProperty}注解指定复杂的头 + *

    3. 直接写即可 */ @Test public void complexHeadWrite() { @@ -477,9 +477,9 @@ public class ComplexHeadData { ```java /** * 重复多次写入 - *

  • 1. 创建excel对应的实体对象 参照{@link ComplexHeadData} - *
  • 2. 使用{@link ExcelProperty}注解指定复杂的头 - *
  • 3. 直接调用二次写入即可 + *

    1. 创建excel对应的实体对象 参照{@link ComplexHeadData} + *

    2. 使用{@link ExcelProperty}注解指定复杂的头 + *

    3. 直接调用二次写入即可 */ @Test public void repeatedWrite() { @@ -526,9 +526,9 @@ public class ConverterData { ```java /** * 日期、数字或者自定义格式转换 - *

  • 1. 创建excel对应的实体对象 参照{@link ConverterData} - *
  • 2. 使用{@link ExcelProperty}配合使用注解{@link DateTimeFormat}、{@link NumberFormat}或者自定义注解 - *
  • 3. 直接写即可 + *

    1. 创建excel对应的实体对象 参照{@link ConverterData} + *

    2. 使用{@link ExcelProperty}配合使用注解{@link DateTimeFormat}、{@link NumberFormat}或者自定义注解 + *

    3. 直接写即可 */ @Test public void converterWrite() { @@ -561,8 +561,8 @@ public class ImageData { ```java /** * 图片导出 - *

  • 1. 创建excel对应的实体对象 参照{@link ImageData} - *
  • 2. 直接写即可 + *

    1. 创建excel对应的实体对象 参照{@link ImageData} + *

    2. 直接写即可 */ @Test public void imageWrite() throws Exception { @@ -601,10 +601,10 @@ public class ImageData { ```java /** * 根据模板写入 - *

  • 1. 创建excel对应的实体对象 参照{@link IndexData} - *
  • 2. 使用{@link ExcelProperty}注解指定写入的列 - *
  • 3. 使用withTemplate 读取模板 - *
  • 4. 直接写即可 + *

    1. 创建excel对应的实体对象 参照{@link IndexData} + *

    2. 使用{@link ExcelProperty}注解指定写入的列 + *

    3. 使用withTemplate 读取模板 + *

    4. 直接写即可 */ @Test public void templateWrite() { @@ -641,9 +641,9 @@ public class WidthAndHeightData { ```java /** * 列宽、行高 - *

  • 1. 创建excel对应的实体对象 参照{@link WidthAndHeightData} - *
  • 2. 使用注解{@link ColumnWidth}、{@link HeadRowHeight}、{@link ContentRowHeight}指定宽度或高度 - *
  • 3. 直接写即可 + *

    1. 创建excel对应的实体对象 参照{@link WidthAndHeightData} + *

    2. 使用注解{@link ColumnWidth}、{@link HeadRowHeight}、{@link ContentRowHeight}指定宽度或高度 + *

    3. 直接写即可 */ @Test public void widthAndHeightWrite() { @@ -662,9 +662,9 @@ public class WidthAndHeightData { ```java /** * 自定义样式 - *

  • 1. 创建excel对应的实体对象 参照{@link DemoData} - *
  • 2. 创建一个style策略 并注册 - *
  • 3. 直接写即可 + *

    1. 创建excel对应的实体对象 参照{@link DemoData} + *

    2. 创建一个style策略 并注册 + *

    3. 直接写即可 */ @Test public void styleWrite() { @@ -705,9 +705,9 @@ public class WidthAndHeightData { ```java /** * 合并单元格 - *

  • 1. 创建excel对应的实体对象 参照{@link DemoData} - *
  • 2. 创建一个merge策略 并注册 - *
  • 3. 直接写即可 + *

    1. 创建excel对应的实体对象 参照{@link DemoData} + *

    2. 创建一个merge策略 并注册 + *

    3. 直接写即可 */ @Test public void mergeWrite() { @@ -729,8 +729,8 @@ public class WidthAndHeightData { ```java /** * 使用table去写入 - *

  • 1. 创建excel对应的实体对象 参照{@link DemoData} - *
  • 2. 然后写入table即可 + *

    1. 创建excel对应的实体对象 参照{@link DemoData} + *

    2. 然后写入table即可 */ @Test public void tableWrite() { @@ -764,8 +764,8 @@ public class WidthAndHeightData { *

    * 思路是这样子的,先创建List头格式的sheet仅仅写入头,然后通过table 不写入头的方式 去写入数据 * - *

  • 1. 创建excel对应的实体对象 参照{@link DemoData} - *
  • 2. 然后写入table即可 + *

    1. 创建excel对应的实体对象 参照{@link DemoData} + *

    2. 然后写入table即可 */ @Test public void dynamicHeadWrite() { @@ -818,9 +818,9 @@ public class LongestMatchColumnWidthData { *

    * poi 自带{@link SXSSFSheet#autoSizeColumn(int)} 对中文支持也不太好。目前没找到很好的算法。 有的话可以推荐下。 * - *

  • 1. 创建excel对应的实体对象 参照{@link DemoData} - *
  • 3. 注册策略{@link LongestMatchColumnWidthStyleStrategy} - *
  • 2. 直接写即可 + *

    1. 创建excel对应的实体对象 参照{@link DemoData} + *

    3. 注册策略{@link LongestMatchColumnWidthStyleStrategy} + *

    2. 直接写即可 */ @Test public void longestMatchColumnWidthWrite() { @@ -852,9 +852,9 @@ DEMO代码地址:[https://github.com/alibaba/easyexcel/blob/master/src/test/ja ```java /** * 文件下载 - *

  • 1. 创建excel对应的实体对象 参照{@link DownloadData} - *
  • 2. 设置返回的 参数 - *
  • 3. 直接写,这里注意,finish的时候会自动关闭OutputStream,当然你外面再关闭流问题不大 + *

    1. 创建excel对应的实体对象 参照{@link DownloadData} + *

    2. 设置返回的 参数 + *

    3. 直接写,这里注意,finish的时候会自动关闭OutputStream,当然你外面再关闭流问题不大 */ @GetMapping("download") public void download(HttpServletResponse response) throws IOException { diff --git a/src/main/java/com/alibaba/excel/EasyExcelFactory.java b/src/main/java/com/alibaba/excel/EasyExcelFactory.java index c1789c13..39fe0311 100644 --- a/src/main/java/com/alibaba/excel/EasyExcelFactory.java +++ b/src/main/java/com/alibaba/excel/EasyExcelFactory.java @@ -136,6 +136,8 @@ public class EasyExcelFactory { * the java OutputStream you wish to write the value to * @param typeEnum * 03 or 07 + * @param needHead + * Whether a write header is required * @return new ExcelWriter * @deprecated please use {@link EasyExcel#write()} */ @@ -157,6 +159,7 @@ public class EasyExcelFactory { * @param typeEnum * 03 or 07 * @param needHead + * Whether a write header is required * @param handler * User-defined callback * @return new ExcelWriter @@ -182,7 +185,8 @@ public class EasyExcelFactory { * Build excel the write * * @param file - * @return + * File to write + * @return Excel writer builder */ public static ExcelWriterBuilder write(File file) { return write(file, null); @@ -192,8 +196,10 @@ public class EasyExcelFactory { * Build excel the write * * @param file + * File to write * @param head - * @return + * Annotate the class for configuration information + * @return Excel writer builder */ public static ExcelWriterBuilder write(File file, Class head) { ExcelWriterBuilder excelWriterBuilder = new ExcelWriterBuilder(); @@ -208,7 +214,8 @@ public class EasyExcelFactory { * Build excel the write * * @param pathName - * @return + * File path to write + * @return Excel writer builder */ public static ExcelWriterBuilder write(String pathName) { return write(pathName, null); @@ -218,8 +225,10 @@ public class EasyExcelFactory { * Build excel the write * * @param pathName + * File path to write * @param head - * @return + * Annotate the class for configuration information + * @return Excel writer builder */ public static ExcelWriterBuilder write(String pathName, Class head) { ExcelWriterBuilder excelWriterBuilder = new ExcelWriterBuilder(); @@ -234,7 +243,8 @@ public class EasyExcelFactory { * Build excel the write * * @param outputStream - * @return + * Output stream to write + * @return Excel writer builder */ public static ExcelWriterBuilder write(OutputStream outputStream) { return write(outputStream, null); @@ -244,8 +254,10 @@ public class EasyExcelFactory { * Build excel the write * * @param outputStream + * Output stream to write * @param head - * @return + * Annotate the class for configuration information. + * @return Excel writer builder */ public static ExcelWriterBuilder write(OutputStream outputStream, Class head) { ExcelWriterBuilder excelWriterBuilder = new ExcelWriterBuilder(); @@ -257,19 +269,20 @@ public class EasyExcelFactory { } /** - * Build excel the 'writerSheet' + * Build excel the writerSheet * - * @return + * @return Excel sheet writer builder */ public static ExcelWriterSheetBuilder writerSheet() { return writerSheet(null, null); } /** - * Build excel the 'writerSheet' + * Build excel the writerSheet * * @param sheetNo - * @return + * Index of sheet,0 base. + * @return Excel sheet writer builder. */ public static ExcelWriterSheetBuilder writerSheet(Integer sheetNo) { return writerSheet(sheetNo, null); @@ -279,7 +292,8 @@ public class EasyExcelFactory { * Build excel the 'writerSheet' * * @param sheetName - * @return + * The name of sheet. + * @return Excel sheet writer builder. */ public static ExcelWriterSheetBuilder writerSheet(String sheetName) { return writerSheet(null, sheetName); @@ -289,8 +303,10 @@ public class EasyExcelFactory { * Build excel the 'writerSheet' * * @param sheetNo + * Index of sheet,0 base. * @param sheetName - * @return + * The name of sheet. + * @return Excel sheet writer builder. */ public static ExcelWriterSheetBuilder writerSheet(Integer sheetNo, String sheetName) { ExcelWriterSheetBuilder excelWriterSheetBuilder = new ExcelWriterSheetBuilder(); @@ -304,9 +320,9 @@ public class EasyExcelFactory { } /** - * Build excel the 'writerTable' + * Build excel the writerTable * - * @return + * @return Excel table writer builder. */ public static ExcelWriterTableBuilder writerTable() { return writerTable(null); @@ -316,7 +332,8 @@ public class EasyExcelFactory { * Build excel the 'writerTable' * * @param tableNo - * @return + * Index of table,0 base. + * @return Excel table writer builder. */ public static ExcelWriterTableBuilder writerTable(Integer tableNo) { ExcelWriterTableBuilder excelWriterTableBuilder = new ExcelWriterTableBuilder(); @@ -329,7 +346,7 @@ public class EasyExcelFactory { /** * Build excel the read * - * @return + * @return Excel reader builder. */ public static ExcelReaderBuilder read() { return new ExcelReaderBuilder(); @@ -339,7 +356,8 @@ public class EasyExcelFactory { * Build excel the read * * @param file - * @return + * File to read. + * @return Excel reader builder. */ public static ExcelReaderBuilder read(File file) { return read(file, null, null); @@ -349,8 +367,10 @@ public class EasyExcelFactory { * Build excel the read * * @param file + * File to read. * @param readListener - * @return + * Read listener. + * @return Excel reader builder. */ public static ExcelReaderBuilder read(File file, ReadListener readListener) { return read(file, null, readListener); @@ -360,9 +380,12 @@ public class EasyExcelFactory { * Build excel the read * * @param file + * File to read. * @param head + * Annotate the class for configuration information. * @param readListener - * @return + * Read listener. + * @return Excel reader builder. */ public static ExcelReaderBuilder read(File file, Class head, ReadListener readListener) { ExcelReaderBuilder excelReaderBuilder = new ExcelReaderBuilder(); @@ -380,7 +403,8 @@ public class EasyExcelFactory { * Build excel the read * * @param pathName - * @return + * File path to read. + * @return Excel reader builder. */ public static ExcelReaderBuilder read(String pathName) { return read(pathName, null, null); @@ -390,8 +414,10 @@ public class EasyExcelFactory { * Build excel the read * * @param pathName + * File path to read. * @param readListener - * @return + * Read listener. + * @return Excel reader builder. */ public static ExcelReaderBuilder read(String pathName, ReadListener readListener) { return read(pathName, null, readListener); @@ -401,9 +427,12 @@ public class EasyExcelFactory { * Build excel the read * * @param pathName + * File path to read. * @param head + * Annotate the class for configuration information. * @param readListener - * @return + * Read listener. + * @return Excel reader builder. */ public static ExcelReaderBuilder read(String pathName, Class head, ReadListener readListener) { ExcelReaderBuilder excelReaderBuilder = new ExcelReaderBuilder(); @@ -421,7 +450,8 @@ public class EasyExcelFactory { * Build excel the read * * @param inputStream - * @return + * Input stream to read. + * @return Excel reader builder. */ public static ExcelReaderBuilder read(InputStream inputStream) { return read(inputStream, null, null); @@ -431,8 +461,10 @@ public class EasyExcelFactory { * Build excel the read * * @param inputStream + * Input stream to read. * @param readListener - * @return + * Read listener. + * @return Excel reader builder. */ public static ExcelReaderBuilder read(InputStream inputStream, ReadListener readListener) { return read(inputStream, null, readListener); @@ -442,9 +474,12 @@ public class EasyExcelFactory { * Build excel the read * * @param inputStream + * Input stream to read. * @param head + * Annotate the class for configuration information. * @param readListener - * @return + * Read listener. + * @return Excel reader builder. */ public static ExcelReaderBuilder read(InputStream inputStream, Class head, ReadListener readListener) { ExcelReaderBuilder excelReaderBuilder = new ExcelReaderBuilder(); @@ -461,7 +496,7 @@ public class EasyExcelFactory { /** * Build excel the 'readSheet' * - * @return + * @return Excel sheet reader builder. */ public static ExcelReaderSheetBuilder readSheet() { return readSheet(null, null); @@ -471,7 +506,8 @@ public class EasyExcelFactory { * Build excel the 'readSheet' * * @param sheetNo - * @return + * Index of sheet,0 base. + * @return Excel sheet reader builder. */ public static ExcelReaderSheetBuilder readSheet(Integer sheetNo) { return readSheet(sheetNo, null); @@ -481,7 +517,8 @@ public class EasyExcelFactory { * Build excel the 'readSheet' * * @param sheetName - * @return + * The name of sheet. + * @return Excel sheet reader builder. */ public static ExcelReaderSheetBuilder readSheet(String sheetName) { return readSheet(null, sheetName); @@ -491,8 +528,10 @@ public class EasyExcelFactory { * Build excel the 'readSheet' * * @param sheetNo + * Index of sheet,0 base. * @param sheetName - * @return + * The name of sheet. + * @return Excel sheet reader builder. */ public static ExcelReaderSheetBuilder readSheet(Integer sheetNo, String sheetName) { ExcelReaderSheetBuilder excelReaderSheetBuilder = new ExcelReaderSheetBuilder(); diff --git a/src/main/java/com/alibaba/excel/ExcelReader.java b/src/main/java/com/alibaba/excel/ExcelReader.java index 4fcb3cab..3cb6b01e 100644 --- a/src/main/java/com/alibaba/excel/ExcelReader.java +++ b/src/main/java/com/alibaba/excel/ExcelReader.java @@ -276,7 +276,6 @@ public class ExcelReader { /** * Prevents calls to {@link #finish} from freeing the cache * - * @throws Throwable */ @Override protected void finalize() { diff --git a/src/main/java/com/alibaba/excel/analysis/ExcelAnalyser.java b/src/main/java/com/alibaba/excel/analysis/ExcelAnalyser.java index f82b52fc..8d987eaf 100644 --- a/src/main/java/com/alibaba/excel/analysis/ExcelAnalyser.java +++ b/src/main/java/com/alibaba/excel/analysis/ExcelAnalyser.java @@ -13,6 +13,7 @@ public interface ExcelAnalyser { * parse one sheet * * @param readSheet + * sheet to read */ void analysis(ReadSheet readSheet); @@ -23,14 +24,14 @@ public interface ExcelAnalyser { /** * Acquisition excel executor - * - * @return + * + * @return Excel file Executor */ ExcelExecutor excelExecutor(); /** * get the analysis context. - * + * * @return analysis context */ AnalysisContext analysisContext(); diff --git a/src/main/java/com/alibaba/excel/analysis/ExcelExecutor.java b/src/main/java/com/alibaba/excel/analysis/ExcelExecutor.java index 9553afbf..8868d2ee 100644 --- a/src/main/java/com/alibaba/excel/analysis/ExcelExecutor.java +++ b/src/main/java/com/alibaba/excel/analysis/ExcelExecutor.java @@ -14,7 +14,7 @@ public interface ExcelExecutor { /** * Returns the actual sheet in excel * - * @return + * @return Actual sheet in excel */ List sheetList(); diff --git a/src/main/java/com/alibaba/excel/analysis/v03/XlsRecordHandler.java b/src/main/java/com/alibaba/excel/analysis/v03/XlsRecordHandler.java index 04dba01d..b786bcb8 100644 --- a/src/main/java/com/alibaba/excel/analysis/v03/XlsRecordHandler.java +++ b/src/main/java/com/alibaba/excel/analysis/v03/XlsRecordHandler.java @@ -14,7 +14,8 @@ public interface XlsRecordHandler extends Comparable { * Which tags are supported * * @param record - * @return + * Excel analysis record + * @return Which tags are supported */ boolean support(Record record); @@ -33,28 +34,28 @@ public interface XlsRecordHandler extends Comparable { /** * Get row * - * @return + * @return Row index */ int getRow(); /** * Get column * - * @return + * @return Column index */ int getColumn(); /** * Get value * - * @return + * @return Excel internal cell data */ CellData getCellData(); /** * Get order * - * @return + * @return Order */ int getOrder(); } diff --git a/src/main/java/com/alibaba/excel/analysis/v07/XlsxCellHandler.java b/src/main/java/com/alibaba/excel/analysis/v07/XlsxCellHandler.java index 831a986e..a4db7f4a 100644 --- a/src/main/java/com/alibaba/excel/analysis/v07/XlsxCellHandler.java +++ b/src/main/java/com/alibaba/excel/analysis/v07/XlsxCellHandler.java @@ -10,24 +10,28 @@ import org.xml.sax.Attributes; public interface XlsxCellHandler { /** * Which tags are supported - * + * * @param name - * @return + * Tag name + * @return Support parsing or not */ boolean support(String name); /** * Start handle - * + * * @param name + * Tag name * @param attributes + * Tag attributes */ void startHandle(String name, Attributes attributes); /** * End handle - * + * * @param name + * Tag name */ void endHandle(String name); } diff --git a/src/main/java/com/alibaba/excel/annotation/ExcelProperty.java b/src/main/java/com/alibaba/excel/annotation/ExcelProperty.java index bbeb4f3a..b107d32e 100644 --- a/src/main/java/com/alibaba/excel/annotation/ExcelProperty.java +++ b/src/main/java/com/alibaba/excel/annotation/ExcelProperty.java @@ -20,10 +20,12 @@ public @interface ExcelProperty { /** * The name of the sheet header. * - *

  • write: It automatically merges when you have more than one head - *
  • read: When you have multiple heads, take the first one + *

    + * write: It automatically merges when you have more than one head + *

    + * read: When you have multiple heads, take the first one * - * @return + * @return The name of the sheet header */ String[] value() default {""}; @@ -32,14 +34,14 @@ public @interface ExcelProperty { * * Read or write it on the index of column,If it's equal to -1, it's sorted by Java class * - * @return + * @return Index of column */ int index() default -1; /** * Force the current field to use this converter. * - * @return + * @return Converter */ Class converter() default AutoConverter.class; @@ -47,7 +49,7 @@ public @interface ExcelProperty { * * default @see com.alibaba.excel.util.TypeUtil if default is not meet you can set format * - * @return + * @return Format string * @deprecated please use {@link com.alibaba.excel.annotation.format.DateTimeFormat} */ @Deprecated diff --git a/src/main/java/com/alibaba/excel/annotation/format/DateTimeFormat.java b/src/main/java/com/alibaba/excel/annotation/format/DateTimeFormat.java index 4d166522..96aff229 100644 --- a/src/main/java/com/alibaba/excel/annotation/format/DateTimeFormat.java +++ b/src/main/java/com/alibaba/excel/annotation/format/DateTimeFormat.java @@ -9,8 +9,10 @@ import java.lang.annotation.Target; /** * Convert date format. * - *

  • write: It can be used on classes {@link java.util.Date} - *
  • read: It can be used on classes {@link String} + *

    + * write: It can be used on classes {@link java.util.Date} + *

    + * read: It can be used on classes {@link String} * * @author Jiaju Zhuang */ @@ -23,14 +25,14 @@ public @interface DateTimeFormat { * * Specific format reference {@link java.text.SimpleDateFormat} * - * @return + * @return Format pattern */ String value() default ""; /** - * true if date uses 1904 windowing, or false if using 1900 date windowing. + * True if date uses 1904 windowing, or false if using 1900 date windowing. * - * @return + * @return True if date uses 1904 windowing, or false if using 1900 date windowing. */ boolean use1904windowing() default false; } diff --git a/src/main/java/com/alibaba/excel/annotation/format/NumberFormat.java b/src/main/java/com/alibaba/excel/annotation/format/NumberFormat.java index 1d371e33..8951681f 100644 --- a/src/main/java/com/alibaba/excel/annotation/format/NumberFormat.java +++ b/src/main/java/com/alibaba/excel/annotation/format/NumberFormat.java @@ -10,8 +10,10 @@ import java.math.RoundingMode; /** * Convert number format. * - *

  • write: It can be used on classes that inherit {@link Number} - *
  • read: It can be used on classes {@link String} + *

    + * write: It can be used on classes that inherit {@link Number} + *

    + * read: It can be used on classes {@link String} * * @author Jiaju Zhuang */ @@ -24,14 +26,14 @@ public @interface NumberFormat { * * Specific format reference {@link org.apache.commons.math3.fraction.BigFractionFormat} * - * @return + * @return Format pattern */ String value() default ""; /** * Rounded by default * - * @return + * @return RoundingMode */ RoundingMode roundingMode() default RoundingMode.HALF_UP; } diff --git a/src/main/java/com/alibaba/excel/annotation/write/style/ColumnWidth.java b/src/main/java/com/alibaba/excel/annotation/write/style/ColumnWidth.java index ae07ff00..00306cc0 100644 --- a/src/main/java/com/alibaba/excel/annotation/write/style/ColumnWidth.java +++ b/src/main/java/com/alibaba/excel/annotation/write/style/ColumnWidth.java @@ -20,6 +20,8 @@ public @interface ColumnWidth { * Column width *

    * -1 means the default column width is used + * + * @return Column width */ int value() default -1; } diff --git a/src/main/java/com/alibaba/excel/annotation/write/style/ContentRowHeight.java b/src/main/java/com/alibaba/excel/annotation/write/style/ContentRowHeight.java index 30069734..8f338e86 100644 --- a/src/main/java/com/alibaba/excel/annotation/write/style/ContentRowHeight.java +++ b/src/main/java/com/alibaba/excel/annotation/write/style/ContentRowHeight.java @@ -21,7 +21,7 @@ public @interface ContentRowHeight { *

    * -1 mean the auto set height * - * @return + * @return Content height */ short value() default -1; } diff --git a/src/main/java/com/alibaba/excel/annotation/write/style/HeadRowHeight.java b/src/main/java/com/alibaba/excel/annotation/write/style/HeadRowHeight.java index 98245b7f..828d2c06 100644 --- a/src/main/java/com/alibaba/excel/annotation/write/style/HeadRowHeight.java +++ b/src/main/java/com/alibaba/excel/annotation/write/style/HeadRowHeight.java @@ -20,7 +20,7 @@ public @interface HeadRowHeight { *

    * -1 mean the auto set height * - * @return + * @return Header height */ short value() default -1; } diff --git a/src/main/java/com/alibaba/excel/cache/ReadCache.java b/src/main/java/com/alibaba/excel/cache/ReadCache.java index 8bc0558a..48072fae 100644 --- a/src/main/java/com/alibaba/excel/cache/ReadCache.java +++ b/src/main/java/com/alibaba/excel/cache/ReadCache.java @@ -13,6 +13,7 @@ public interface ReadCache { * Initialize cache * * @param analysisContext + * A context is the main anchorage point of a excel reader. */ void init(AnalysisContext analysisContext); @@ -20,6 +21,7 @@ public interface ReadCache { * Automatically generate the key and put it in the cache.Key start from 0 * * @param value + * Cache value */ void put(String value); @@ -27,7 +29,8 @@ public interface ReadCache { * Get value * * @param key - * @return + * Index + * @return Value */ String get(Integer key); diff --git a/src/main/java/com/alibaba/excel/context/AnalysisContext.java b/src/main/java/com/alibaba/excel/context/AnalysisContext.java index 2704bfd9..7b8ba86c 100644 --- a/src/main/java/com/alibaba/excel/context/AnalysisContext.java +++ b/src/main/java/com/alibaba/excel/context/AnalysisContext.java @@ -15,56 +15,59 @@ import com.alibaba.excel.support.ExcelTypeEnum; /** * * A context is the main anchorage point of a excel reader. - * + * * @author jipengfei */ public interface AnalysisContext { /** * Select the current table - * + * * @param excelExecutor + * Excel file Executor * @param readSheet + * sheet to read */ void currentSheet(ExcelExecutor excelExecutor, ReadSheet readSheet); /** * All information about the workbook you are currently working on * - * @return + * @return Current workbook holder */ ReadWorkbookHolder readWorkbookHolder(); /** * All information about the sheet you are currently working on * - * @return + * @return Current sheet holder */ ReadSheetHolder readSheetHolder(); /** * Set row of currently operated cell - * + * * @param readRowHolder + * Current row holder */ void readRowHolder(ReadRowHolder readRowHolder); /** * Row of currently operated cell * - * @return + * @return Current row holder */ ReadRowHolder readRowHolder(); /** - * The current read operation corresponds to the 'readSheetHolder' or 'readWorkbookHolder' - * - * @return + * The current read operation corresponds to the readSheetHolder or readWorkbookHolder + * + * @return Current holder */ ReadHolder currentReadHolder(); /** * Custom attribute - * + * * @return */ Object getCustom(); @@ -81,7 +84,7 @@ public interface AnalysisContext { /** * * get excel type - * + * * @return excel type * @deprecated please use {@link #readWorkbookHolder()} */ @@ -90,7 +93,7 @@ public interface AnalysisContext { /** * get in io - * + * * @return file io * @deprecated please use {@link #readWorkbookHolder()} */ @@ -99,7 +102,7 @@ public interface AnalysisContext { /** * get current row - * + * * @return * @deprecated please use {@link #readRowHolder()} */ @@ -108,7 +111,7 @@ public interface AnalysisContext { /** * get total row ,Data may be inaccurate - * + * * @return * @deprecated please use {@link #readRowHolder()} */ @@ -126,7 +129,7 @@ public interface AnalysisContext { /** * Interrupt execution - * + * * @deprecated please use {@link AnalysisEventListener#hasNext(AnalysisContext)} */ @Deprecated diff --git a/src/main/java/com/alibaba/excel/converters/Converter.java b/src/main/java/com/alibaba/excel/converters/Converter.java index 22d8c3cf..8700d127 100644 --- a/src/main/java/com/alibaba/excel/converters/Converter.java +++ b/src/main/java/com/alibaba/excel/converters/Converter.java @@ -16,14 +16,14 @@ public interface Converter { /** * Back to object types in Java * - * @return + * @return Support for Java class */ Class supportJavaTypeKey(); /** * Back to object enum in excel * - * @return + * @return Support for {@link CellDataTypeEnum} */ CellDataTypeEnum supportExcelTypeKey(); @@ -31,13 +31,14 @@ public interface Converter { * Convert excel objects to Java objects * * @param cellData - * NotNull + * Excel cell data.NotNull. * @param contentProperty - * Nullable + * Content property.Nullable. * @param globalConfiguration - * NotNull - * @return + * Global configuration.NotNull. + * @return Data to put into a Java object * @throws Exception + * Exception. */ T convertToJavaData(CellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception; @@ -46,13 +47,14 @@ public interface Converter { * Convert Java objects to excel objects * * @param value - * NotNull + * Java Data.NotNull. * @param contentProperty - * Nullable + * Content property.Nullable. * @param globalConfiguration - * NotNull - * @return + * Global configuration.NotNull. + * @return Data to put into a Excel * @throws Exception + * Exception. */ CellData convertToExcelData(T value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception; diff --git a/src/main/java/com/alibaba/excel/event/WriteHandler.java b/src/main/java/com/alibaba/excel/event/WriteHandler.java index 37dcc5ea..8c981ffc 100644 --- a/src/main/java/com/alibaba/excel/event/WriteHandler.java +++ b/src/main/java/com/alibaba/excel/event/WriteHandler.java @@ -7,7 +7,7 @@ import org.apache.poi.ss.usermodel.Sheet; /** * * @author jipengfei - * @deprecated please use {@ com.alibaba.excel.write.handler.WriteHandler} + * @deprecated please use {@link com.alibaba.excel.write.handler.WriteHandler} */ @Deprecated public interface WriteHandler { @@ -30,7 +30,7 @@ public interface WriteHandler { /** * Custom operation after creating each cell - * + * * @param cellNum * @param cell */ diff --git a/src/main/java/com/alibaba/excel/exception/ExcelAnalysisException.java b/src/main/java/com/alibaba/excel/exception/ExcelAnalysisException.java index 80d7a25f..490c541e 100644 --- a/src/main/java/com/alibaba/excel/exception/ExcelAnalysisException.java +++ b/src/main/java/com/alibaba/excel/exception/ExcelAnalysisException.java @@ -6,8 +6,7 @@ package com.alibaba.excel.exception; */ public class ExcelAnalysisException extends RuntimeException { - public ExcelAnalysisException() { - } + public ExcelAnalysisException() {} public ExcelAnalysisException(String message) { super(message); diff --git a/src/main/java/com/alibaba/excel/exception/ExcelGenerateException.java b/src/main/java/com/alibaba/excel/exception/ExcelGenerateException.java index 266cf465..f508b17f 100644 --- a/src/main/java/com/alibaba/excel/exception/ExcelGenerateException.java +++ b/src/main/java/com/alibaba/excel/exception/ExcelGenerateException.java @@ -5,7 +5,6 @@ package com.alibaba.excel.exception; */ public class ExcelGenerateException extends RuntimeException { - public ExcelGenerateException(String message) { super(message); } diff --git a/src/main/java/com/alibaba/excel/metadata/AbstractHolder.java b/src/main/java/com/alibaba/excel/metadata/AbstractHolder.java index 1694e5e4..37a19422 100644 --- a/src/main/java/com/alibaba/excel/metadata/AbstractHolder.java +++ b/src/main/java/com/alibaba/excel/metadata/AbstractHolder.java @@ -29,8 +29,10 @@ public abstract class AbstractHolder implements ConfigurationHolder { private GlobalConfiguration globalConfiguration; /** - *

  • Read key: - *
  • Write key: + *

    + * Read key: + *

    + * Write key: */ private Map converterMap; diff --git a/src/main/java/com/alibaba/excel/metadata/CellData.java b/src/main/java/com/alibaba/excel/metadata/CellData.java index 7cd1103e..db73ce8f 100644 --- a/src/main/java/com/alibaba/excel/metadata/CellData.java +++ b/src/main/java/com/alibaba/excel/metadata/CellData.java @@ -3,7 +3,7 @@ package com.alibaba.excel.metadata; import com.alibaba.excel.enums.CellDataTypeEnum; /** - * excel internal cell data + * Excel internal cell data * * @author Jiaju Zhuang */ diff --git a/src/main/java/com/alibaba/excel/metadata/ConfigurationHolder.java b/src/main/java/com/alibaba/excel/metadata/ConfigurationHolder.java index 54ef161a..d84b1d58 100644 --- a/src/main/java/com/alibaba/excel/metadata/ConfigurationHolder.java +++ b/src/main/java/com/alibaba/excel/metadata/ConfigurationHolder.java @@ -16,21 +16,21 @@ public interface ConfigurationHolder extends Holder { * * Record whether it's new or from cache * - * @return + * @return Record whether it's new or from cache */ boolean isNew(); /** * Some global variables * - * @return + * @return Global configuration */ GlobalConfiguration globalConfiguration(); /** * What converter does the currently operated cell need to execute * - * @return + * @return Converter */ Map converterMap(); } diff --git a/src/main/java/com/alibaba/excel/metadata/Holder.java b/src/main/java/com/alibaba/excel/metadata/Holder.java index fd2f23e9..f2f430f2 100644 --- a/src/main/java/com/alibaba/excel/metadata/Holder.java +++ b/src/main/java/com/alibaba/excel/metadata/Holder.java @@ -13,7 +13,7 @@ public interface Holder { /** * What holder is the return * - * @return + * @return Holder enum. */ HolderEnum holderType(); diff --git a/src/main/java/com/alibaba/excel/read/builder/ExcelReaderBuilder.java b/src/main/java/com/alibaba/excel/read/builder/ExcelReaderBuilder.java index d86063b6..15d4a02c 100644 --- a/src/main/java/com/alibaba/excel/read/builder/ExcelReaderBuilder.java +++ b/src/main/java/com/alibaba/excel/read/builder/ExcelReaderBuilder.java @@ -63,10 +63,10 @@ public class ExcelReaderBuilder { return file(new File(pathName)); } - /** * Mandatory use 'inputStream' .Default is false. - *

  • if false,Will transfer 'inputStream' to temporary files to improve efficiency + *

    + * if false,Will transfer 'inputStream' to temporary files to improve efficiency */ public ExcelReaderBuilder mandatoryUseInputStream(Boolean mandatoryUseInputStream) { readWorkbook.setMandatoryUseInputStream(mandatoryUseInputStream); @@ -110,9 +110,12 @@ public class ExcelReaderBuilder { /** * Count the number of added heads when read sheet. * - *

  • 0 - This Sheet has no head ,since the first row are the data - *
  • 1 - This Sheet has one row head , this is the default - *
  • 2 - This Sheet has two row head ,since the third row is the data + *

    + * 0 - This Sheet has no head ,since the first row are the data + *

    + * 1 - This Sheet has one row head , this is the default + *

    + * 2 - This Sheet has two row head ,since the third row is the data * * @param headRowNumber * @return diff --git a/src/main/java/com/alibaba/excel/read/builder/ExcelReaderSheetBuilder.java b/src/main/java/com/alibaba/excel/read/builder/ExcelReaderSheetBuilder.java index eb03981d..af3b05e1 100644 --- a/src/main/java/com/alibaba/excel/read/builder/ExcelReaderSheetBuilder.java +++ b/src/main/java/com/alibaba/excel/read/builder/ExcelReaderSheetBuilder.java @@ -57,9 +57,12 @@ public class ExcelReaderSheetBuilder { /** * Count the number of added heads when read sheet. * - *

  • 0 - This Sheet has no head ,since the first row are the data - *
  • 1 - This Sheet has one row head , this is the default - *
  • 2 - This Sheet has two row head ,since the third row is the data + *

    + * 0 - This Sheet has no head ,since the first row are the data + *

    + * 1 - This Sheet has one row head , this is the default + *

    + * 2 - This Sheet has two row head ,since the third row is the data * * @param headRowNumber * @return @@ -149,8 +152,6 @@ public class ExcelReaderSheetBuilder { /** * Sax read - * - * @return */ public void doRead() { if (excelReader == null) { diff --git a/src/main/java/com/alibaba/excel/read/listener/ReadListenerRegistryCenter.java b/src/main/java/com/alibaba/excel/read/listener/ReadListenerRegistryCenter.java index 58baeae9..07bc68c2 100644 --- a/src/main/java/com/alibaba/excel/read/listener/ReadListenerRegistryCenter.java +++ b/src/main/java/com/alibaba/excel/read/listener/ReadListenerRegistryCenter.java @@ -13,8 +13,9 @@ public interface ReadListenerRegistryCenter { /** * register - * + * * @param listener + * Analysis listener */ void register(AnalysisEventListener listener); @@ -24,13 +25,15 @@ public interface ReadListenerRegistryCenter { * @param event * parse event * @param analysisContext + * Analysis context */ void notifyEndOneRow(AnalysisFinishEvent event, AnalysisContext analysisContext); /** * Notify after all analysed - * + * * @param analysisContext + * Analysis context */ void notifyAfterAllAnalysed(AnalysisContext analysisContext); } diff --git a/src/main/java/com/alibaba/excel/read/metadata/ReadBasicParameter.java b/src/main/java/com/alibaba/excel/read/metadata/ReadBasicParameter.java index 6141aef1..d4035873 100644 --- a/src/main/java/com/alibaba/excel/read/metadata/ReadBasicParameter.java +++ b/src/main/java/com/alibaba/excel/read/metadata/ReadBasicParameter.java @@ -15,9 +15,12 @@ public class ReadBasicParameter extends BasicParameter { /** * Count the number of added heads when read sheet. * - *

  • 0 - This Sheet has no head ,since the first row are the data - *
  • 1 - This Sheet has one row head , this is the default - *
  • 2 - This Sheet has two row head ,since the third row is the data + *

    + * 0 - This Sheet has no head ,since the first row are the data + *

    + * 1 - This Sheet has one row head , this is the default + *

    + * 2 - This Sheet has two row head ,since the third row is the data */ private Integer headRowNumber; /** diff --git a/src/main/java/com/alibaba/excel/read/metadata/ReadWorkbook.java b/src/main/java/com/alibaba/excel/read/metadata/ReadWorkbook.java index 0113b542..360f941f 100644 --- a/src/main/java/com/alibaba/excel/read/metadata/ReadWorkbook.java +++ b/src/main/java/com/alibaba/excel/read/metadata/ReadWorkbook.java @@ -32,7 +32,8 @@ public class ReadWorkbook extends ReadBasicParameter { private File file; /** * Mandatory use 'inputStream' .Default is false. - *

  • if false,Will transfer 'inputStream' to temporary files to improve efficiency + *

    + * if false,Will transfer 'inputStream' to temporary files to improve efficiency */ private Boolean mandatoryUseInputStream; /** @@ -51,8 +52,10 @@ public class ReadWorkbook extends ReadBasicParameter { private ReadCache readCache; /** * The default is all excel objects.Default is true. - *

  • if true , you can use {@link com.alibaba.excel.annotation.ExcelIgnore} ignore a field. - *
  • if false , you must use {@link com.alibaba.excel.annotation.ExcelProperty} to use a filed. + *

    + * if true , you can use {@link com.alibaba.excel.annotation.ExcelIgnore} ignore a field. + *

    + * if false , you must use {@link com.alibaba.excel.annotation.ExcelProperty} to use a filed. * * @deprecated Just to be compatible with historical data, The default is always going to be convert all filed. */ diff --git a/src/main/java/com/alibaba/excel/read/metadata/holder/AbstractReadHolder.java b/src/main/java/com/alibaba/excel/read/metadata/holder/AbstractReadHolder.java index 27367887..61aa8137 100644 --- a/src/main/java/com/alibaba/excel/read/metadata/holder/AbstractReadHolder.java +++ b/src/main/java/com/alibaba/excel/read/metadata/holder/AbstractReadHolder.java @@ -37,9 +37,12 @@ public abstract class AbstractReadHolder extends AbstractHolder implements ReadH /** * Count the number of added heads when read sheet. * - *

  • 0 - This Sheet has no head ,since the first row are the data - *
  • 1 - This Sheet has one row head , this is the default - *
  • 2 - This Sheet has two row head ,since the third row is the data + *

    + * 0 - This Sheet has no head ,since the first row are the data + *

    + * 1 - This Sheet has one row head , this is the default + *

    + * 2 - This Sheet has two row head ,since the third row is the data */ private Integer headRowNumber; /** diff --git a/src/main/java/com/alibaba/excel/read/metadata/holder/ReadHolder.java b/src/main/java/com/alibaba/excel/read/metadata/holder/ReadHolder.java index bda58225..43e13013 100644 --- a/src/main/java/com/alibaba/excel/read/metadata/holder/ReadHolder.java +++ b/src/main/java/com/alibaba/excel/read/metadata/holder/ReadHolder.java @@ -16,14 +16,14 @@ public interface ReadHolder extends ConfigurationHolder { /** * What handler does the currently operated cell need to execute * - * @return + * @return Current {@link ReadListener} */ List readListenerList(); /** - * What 'ExcelReadHeadProperty' does the currently operated cell need to execute + * What {@link ExcelReadHeadProperty} does the currently operated cell need to execute * - * @return + * @return Current {@link ExcelReadHeadProperty} */ ExcelReadHeadProperty excelReadHeadProperty(); diff --git a/src/main/java/com/alibaba/excel/read/metadata/holder/ReadWorkbookHolder.java b/src/main/java/com/alibaba/excel/read/metadata/holder/ReadWorkbookHolder.java index 35b6f21e..bfcc0506 100644 --- a/src/main/java/com/alibaba/excel/read/metadata/holder/ReadWorkbookHolder.java +++ b/src/main/java/com/alibaba/excel/read/metadata/holder/ReadWorkbookHolder.java @@ -43,7 +43,8 @@ public class ReadWorkbookHolder extends AbstractReadHolder { private File file; /** * Mandatory use 'inputStream' .Default is false. - *

  • if false,Will transfer 'inputStream' to temporary files to improve efficiency + *

    + * if false,Will transfer 'inputStream' to temporary files to improve efficiency */ private Boolean mandatoryUseInputStream; /** diff --git a/src/main/java/com/alibaba/excel/util/BooleanUtils.java b/src/main/java/com/alibaba/excel/util/BooleanUtils.java index bb588968..afd1495d 100644 --- a/src/main/java/com/alibaba/excel/util/BooleanUtils.java +++ b/src/main/java/com/alibaba/excel/util/BooleanUtils.java @@ -13,8 +13,6 @@ public class BooleanUtils { /** * String to boolean * - *

  • - * * @param str * @return */ diff --git a/src/main/java/com/alibaba/excel/util/PositionUtils.java b/src/main/java/com/alibaba/excel/util/PositionUtils.java index 37a87dd5..31510408 100644 --- a/src/main/java/com/alibaba/excel/util/PositionUtils.java +++ b/src/main/java/com/alibaba/excel/util/PositionUtils.java @@ -9,7 +9,7 @@ public class PositionUtils { int row = 0; if (currentCellIndex != null) { String rowStr = currentCellIndex.replaceAll("[A-Z]", "").replaceAll("[a-z]", ""); - row = Integer.parseInt(rowStr)-1; + row = Integer.parseInt(rowStr) - 1; } return row; } @@ -23,6 +23,6 @@ public class PositionUtils { col += (currentIndex[i] - '@') * Math.pow(26, (currentIndex.length - i - 1)); } } - return col-1; + return col - 1; } } diff --git a/src/main/java/com/alibaba/excel/write/merge/AbstractMergeStrategy.java b/src/main/java/com/alibaba/excel/write/merge/AbstractMergeStrategy.java index 09513562..7b95f1c5 100644 --- a/src/main/java/com/alibaba/excel/write/merge/AbstractMergeStrategy.java +++ b/src/main/java/com/alibaba/excel/write/merge/AbstractMergeStrategy.java @@ -23,8 +23,8 @@ public abstract class AbstractMergeStrategy implements CellWriteHandler { } @Override - public void afterCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, CellData cellData, Cell cell, - Head head, int relativeRowIndex, boolean isHead) { + public void afterCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, CellData cellData, + Cell cell, Head head, int relativeRowIndex, boolean isHead) { if (isHead) { return; } diff --git a/src/main/java/com/alibaba/excel/write/metadata/WriteWorkbook.java b/src/main/java/com/alibaba/excel/write/metadata/WriteWorkbook.java index 9423f31c..8ea5209f 100644 --- a/src/main/java/com/alibaba/excel/write/metadata/WriteWorkbook.java +++ b/src/main/java/com/alibaba/excel/write/metadata/WriteWorkbook.java @@ -52,8 +52,10 @@ public class WriteWorkbook extends WriteBasicParameter { private Boolean mandatoryUseInputStream; /** * The default is all excel objects.Default is true. - *
  • if true , you can use {@link com.alibaba.excel.annotation.ExcelIgnore} ignore a field. - *
  • if false , you must use {@link com.alibaba.excel.annotation.ExcelProperty} to use a filed. + *

    + * if true , you can use {@link com.alibaba.excel.annotation.ExcelIgnore} ignore a field. + *

    + * if false , you must use {@link com.alibaba.excel.annotation.ExcelProperty} to use a filed. * * @deprecated Just to be compatible with historical data, The default is always going to be convert all filed. */ diff --git a/src/main/java/com/alibaba/excel/write/style/HorizontalCellStyleStrategy.java b/src/main/java/com/alibaba/excel/write/style/HorizontalCellStyleStrategy.java index 64f90894..da5e53bc 100644 --- a/src/main/java/com/alibaba/excel/write/style/HorizontalCellStyleStrategy.java +++ b/src/main/java/com/alibaba/excel/write/style/HorizontalCellStyleStrategy.java @@ -25,7 +25,8 @@ public class HorizontalCellStyleStrategy extends AbstractCellStyleStrategy { private CellStyle headCellStyle; private List contentCellStyleList; - public HorizontalCellStyleStrategy(WriteCellStyle headWriteCellStyle, List contentWriteCellStyleList) { + public HorizontalCellStyleStrategy(WriteCellStyle headWriteCellStyle, + List contentWriteCellStyleList) { this.headWriteCellStyle = headWriteCellStyle; this.contentWriteCellStyleList = contentWriteCellStyleList; } diff --git a/src/main/java/com/alibaba/excel/write/style/column/AbstractHeadColumnWidthStyleStrategy.java b/src/main/java/com/alibaba/excel/write/style/column/AbstractHeadColumnWidthStyleStrategy.java index 802f15f2..da9b7dac 100644 --- a/src/main/java/com/alibaba/excel/write/style/column/AbstractHeadColumnWidthStyleStrategy.java +++ b/src/main/java/com/alibaba/excel/write/style/column/AbstractHeadColumnWidthStyleStrategy.java @@ -28,7 +28,8 @@ public abstract class AbstractHeadColumnWidthStyleStrategy extends AbstractColum /** * Returns the column width corresponding to each column head. * - *

  • if return null,ignore + *

    + * if return null,ignore * * @param head * Nullable diff --git a/src/test/java/com/alibaba/easyexcel/test/core/exception/ExceptionDataTest.java b/src/test/java/com/alibaba/easyexcel/test/core/exception/ExceptionDataTest.java index 0a5d0a72..93210cfd 100644 --- a/src/test/java/com/alibaba/easyexcel/test/core/exception/ExceptionDataTest.java +++ b/src/test/java/com/alibaba/easyexcel/test/core/exception/ExceptionDataTest.java @@ -42,8 +42,7 @@ public class ExceptionDataTest { private void readAndWrite(File file) throws Exception { EasyExcel.write(new FileOutputStream(file), ExceptionData.class).sheet().doWrite(data()); - EasyExcel.read(new FileInputStream(file), ExceptionData.class, new ExceptionDataListener()).sheet() - .doRead(); + EasyExcel.read(new FileInputStream(file), ExceptionData.class, new ExceptionDataListener()).sheet().doRead(); } private List data() { diff --git a/src/test/java/com/alibaba/easyexcel/test/core/parameter/ParameterDataTest.java b/src/test/java/com/alibaba/easyexcel/test/core/parameter/ParameterDataTest.java index 5fa0a65c..cc97cd06 100644 --- a/src/test/java/com/alibaba/easyexcel/test/core/parameter/ParameterDataTest.java +++ b/src/test/java/com/alibaba/easyexcel/test/core/parameter/ParameterDataTest.java @@ -47,8 +47,8 @@ public class ParameterDataTest { private void readAndWrite1() { EasyExcel.write(file.getPath()).head(ParameterData.class).sheet().doWrite(data()); - EasyExcel.read(file.getPath()).head(ParameterData.class) - .registerReadListener(new ParameterDataListener()).sheet().doRead(); + EasyExcel.read(file.getPath()).head(ParameterData.class).registerReadListener(new ParameterDataListener()) + .sheet().doRead(); } private void readAndWrite2() { @@ -58,8 +58,8 @@ public class ParameterDataTest { private void readAndWrite3() throws Exception { EasyExcel.write(new FileOutputStream(file)).head(ParameterData.class).sheet().doWrite(data()); - EasyExcel.read(file.getPath()).head(ParameterData.class) - .registerReadListener(new ParameterDataListener()).sheet().doRead(); + EasyExcel.read(file.getPath()).head(ParameterData.class).registerReadListener(new ParameterDataListener()) + .sheet().doRead(); } private void readAndWrite4() throws Exception { @@ -68,16 +68,15 @@ public class ParameterDataTest { } private void readAndWrite5() throws Exception { - ExcelWriter excelWriter = EasyExcel.write(new FileOutputStream(file)).head(ParameterData.class) - .relativeHeadRowIndex(0).build(); + ExcelWriter excelWriter = + EasyExcel.write(new FileOutputStream(file)).head(ParameterData.class).relativeHeadRowIndex(0).build(); WriteSheet writeSheet = EasyExcel.writerSheet(0).relativeHeadRowIndex(0).needHead(Boolean.FALSE).build(); WriteTable writeTable = EasyExcel.writerTable(0).relativeHeadRowIndex(0).needHead(Boolean.TRUE).build(); excelWriter.write(data(), writeSheet, writeTable); excelWriter.finish(); - ExcelReader excelReader = - EasyExcel.read(file.getPath(), new ParameterDataListener()).head(ParameterData.class) - .mandatoryUseInputStream(Boolean.FALSE).autoCloseStream(Boolean.TRUE).readCache(new MapCache()).build(); + ExcelReader excelReader = EasyExcel.read(file.getPath(), new ParameterDataListener()).head(ParameterData.class) + .mandatoryUseInputStream(Boolean.FALSE).autoCloseStream(Boolean.TRUE).readCache(new MapCache()).build(); ReadSheet readSheet = EasyExcel.readSheet().head(ParameterData.class).use1904windowing(Boolean.FALSE) .headRowNumber(1).sheetNo(0).sheetName("0").build(); excelReader.read(readSheet); @@ -90,17 +89,16 @@ public class ParameterDataTest { } private void readAndWrite6() throws Exception { - ExcelWriter excelWriter = EasyExcel.write(new FileOutputStream(file)).head(ParameterData.class) - .relativeHeadRowIndex(0).build(); + ExcelWriter excelWriter = + EasyExcel.write(new FileOutputStream(file)).head(ParameterData.class).relativeHeadRowIndex(0).build(); WriteSheet writeSheet = EasyExcel.writerSheet(0).relativeHeadRowIndex(0).needHead(Boolean.FALSE).build(); WriteTable writeTable = EasyExcel.writerTable(0).registerConverter(new StringStringConverter()) .relativeHeadRowIndex(0).needHead(Boolean.TRUE).build(); excelWriter.write(data(), writeSheet, writeTable); excelWriter.finish(); - ExcelReader excelReader = - EasyExcel.read(file.getPath(), new ParameterDataListener()).head(ParameterData.class) - .mandatoryUseInputStream(Boolean.FALSE).autoCloseStream(Boolean.TRUE).readCache(new MapCache()).build(); + ExcelReader excelReader = EasyExcel.read(file.getPath(), new ParameterDataListener()).head(ParameterData.class) + .mandatoryUseInputStream(Boolean.FALSE).autoCloseStream(Boolean.TRUE).readCache(new MapCache()).build(); ReadSheet readSheet = EasyExcel.readSheet("0").head(ParameterData.class).use1904windowing(Boolean.FALSE) .headRowNumber(1).sheetNo(0).build(); excelReader.read(readSheet); @@ -116,9 +114,8 @@ public class ParameterDataTest { EasyExcel.write(file, ParameterData.class).registerConverter(new StringStringConverter()).sheet() .registerConverter(new StringStringConverter()).needHead(Boolean.FALSE).table(0).needHead(Boolean.TRUE) .doWrite(data()); - EasyExcel.read(file.getPath()).head(ParameterData.class) - .registerReadListener(new ParameterDataListener()).sheet().registerConverter(new StringStringConverter()) - .doRead(); + EasyExcel.read(file.getPath()).head(ParameterData.class).registerReadListener(new ParameterDataListener()) + .sheet().registerConverter(new StringStringConverter()).doRead(); } private List data() { diff --git a/src/test/java/com/alibaba/easyexcel/test/core/repetition/RepetitionDataTest.java b/src/test/java/com/alibaba/easyexcel/test/core/repetition/RepetitionDataTest.java index ecb8df01..5005764f 100644 --- a/src/test/java/com/alibaba/easyexcel/test/core/repetition/RepetitionDataTest.java +++ b/src/test/java/com/alibaba/easyexcel/test/core/repetition/RepetitionDataTest.java @@ -51,8 +51,7 @@ public class RepetitionDataTest { ExcelWriter excelWriter = EasyExcel.write(file, RepetitionData.class).build(); WriteSheet writeSheet = EasyExcel.writerSheet(0).build(); excelWriter.write(data(), writeSheet).write(data(), writeSheet).finish(); - ExcelReader excelReader = - EasyExcel.read(file, RepetitionData.class, new RepetitionDataListener()).build(); + ExcelReader excelReader = EasyExcel.read(file, RepetitionData.class, new RepetitionDataListener()).build(); ReadSheet readSheet = EasyExcel.readSheet(0).build(); excelReader.read(readSheet).finish(); } @@ -72,8 +71,7 @@ public class RepetitionDataTest { WriteSheet writeSheet = EasyExcel.writerSheet(0).build(); WriteTable writeTable = EasyExcel.writerTable(0).relativeHeadRowIndex(0).build(); excelWriter.write(data(), writeSheet, writeTable).write(data(), writeSheet, writeTable).finish(); - ExcelReader excelReader = - EasyExcel.read(file, RepetitionData.class, new RepetitionDataListener()).build(); + ExcelReader excelReader = EasyExcel.read(file, RepetitionData.class, new RepetitionDataListener()).build(); ReadSheet readSheet = EasyExcel.readSheet(0).headRowNumber(2).build(); excelReader.read(readSheet).finish(); } diff --git a/src/test/java/com/alibaba/easyexcel/test/demo/read/ReadTest.java b/src/test/java/com/alibaba/easyexcel/test/demo/read/ReadTest.java index 691e43a4..90524d36 100644 --- a/src/test/java/com/alibaba/easyexcel/test/demo/read/ReadTest.java +++ b/src/test/java/com/alibaba/easyexcel/test/demo/read/ReadTest.java @@ -30,9 +30,12 @@ public class ReadTest { /** * 最简单的读 - *

  • 1. 创建excel对应的实体对象 参照{@link DemoData} - *
  • 2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link DemoDataListener} - *
  • 3. 直接读即可 + *

    + * 1. 创建excel对应的实体对象 参照{@link DemoData} + *

    + * 2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link DemoDataListener} + *

    + * 3. 直接读即可 */ @Test public void simpleRead() { @@ -53,9 +56,12 @@ public class ReadTest { /** * 指定列的下标或者列名 * - *

  • 1. 创建excel对应的实体对象,并使用{@link ExcelProperty}注解. 参照{@link IndexOrNameData} - *
  • 2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link IndexOrNameDataListener} - *
  • 3. 直接读即可 + *

    + * 1. 创建excel对应的实体对象,并使用{@link ExcelProperty}注解. 参照{@link IndexOrNameData} + *

    + * 2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link IndexOrNameDataListener} + *

    + * 3. 直接读即可 */ @Test public void indexOrNameRead() { @@ -66,9 +72,12 @@ public class ReadTest { /** * 读多个sheet,这里注意一个sheet不能读取多次,多次读取需要重新读取文件 - *

  • 1. 创建excel对应的实体对象 参照{@link DemoData} - *
  • 2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link DemoDataListener} - *
  • 3. 直接读即可 + *

    + * 1. 创建excel对应的实体对象 参照{@link DemoData} + *

    + * 2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link DemoDataListener} + *

    + * 3. 直接读即可 */ @Test public void repeatedRead() { @@ -86,9 +95,12 @@ public class ReadTest { * 日期、数字或者自定义格式转换 *

    * 默认读的转换器{@link DefaultConverterLoader#loadDefaultReadConverter()} - *

  • 1. 创建excel对应的实体对象 参照{@link ConverterData}.里面可以使用注解{@link DateTimeFormat}、{@link NumberFormat}或者自定义注解 - *
  • 2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link ConverterDataListener} - *
  • 3. 直接读即可 + *

    + * 1. 创建excel对应的实体对象 参照{@link ConverterData}.里面可以使用注解{@link DateTimeFormat}、{@link NumberFormat}或者自定义注解 + *

    + * 2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link ConverterDataListener} + *

    + * 3. 直接读即可 */ @Test public void converterRead() { @@ -105,9 +117,12 @@ public class ReadTest { /** * 多行头 * - *

  • 1. 创建excel对应的实体对象 参照{@link DemoData} - *
  • 2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link DemoDataListener} - *
  • 3. 设置headRowNumber参数,然后读。 这里要注意headRowNumber如果不指定, 会根据你传入的class的{@link ExcelProperty#value()}里面的表头的数量来决定行数, + *

    + * 1. 创建excel对应的实体对象 参照{@link DemoData} + *

    + * 2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link DemoDataListener} + *

    + * 3. 设置headRowNumber参数,然后读。 这里要注意headRowNumber如果不指定, 会根据你传入的class的{@link ExcelProperty#value()}里面的表头的数量来决定行数, * 如果不传入class则默认为1.当然你指定了headRowNumber不管是否传入class都是以你传入的为准。 */ @Test diff --git a/src/test/java/com/alibaba/easyexcel/test/demo/web/WebTest.java b/src/test/java/com/alibaba/easyexcel/test/demo/web/WebTest.java index 108ba00c..d96f89bc 100644 --- a/src/test/java/com/alibaba/easyexcel/test/demo/web/WebTest.java +++ b/src/test/java/com/alibaba/easyexcel/test/demo/web/WebTest.java @@ -24,9 +24,12 @@ import com.alibaba.excel.EasyExcel; public class WebTest { /** * 文件下载 - *

  • 1. 创建excel对应的实体对象 参照{@link DownloadData} - *
  • 2. 设置返回的 参数 - *
  • 3. 直接写,这里注意,finish的时候会自动关闭OutputStream,当然你外面再关闭流问题不大 + *

    + * 1. 创建excel对应的实体对象 参照{@link DownloadData} + *

    + * 2. 设置返回的 参数 + *

    + * 3. 直接写,这里注意,finish的时候会自动关闭OutputStream,当然你外面再关闭流问题不大 */ @GetMapping("download") public void download(HttpServletResponse response) throws IOException { @@ -38,9 +41,12 @@ public class WebTest { /** * 文件上传 - *

  • 1. 创建excel对应的实体对象 参照{@link UploadData} - *
  • 2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link UploadDataListener} - *
  • 3. 直接读即可 + *

    + * 1. 创建excel对应的实体对象 参照{@link UploadData} + *

    + * 2. 由于默认异步读取excel,所以需要创建excel一行一行的回调监听器,参照{@link UploadDataListener} + *

    + * 3. 直接读即可 */ @PostMapping("upload") @ResponseBody diff --git a/src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java b/src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java index 9bd94677..482f8f72 100644 --- a/src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java +++ b/src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java @@ -39,8 +39,10 @@ import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy public class WriteTest { /** * 最简单的写 - *

  • 1. 创建excel对应的实体对象 参照{@link DemoData} - *
  • 2. 直接写即可 + *

    + * 1. 创建excel对应的实体对象 参照{@link DemoData} + *

    + * 2. 直接写即可 */ @Test public void simpleWrite() { @@ -62,9 +64,12 @@ public class WriteTest { /** * 指定写入的列 - *

  • 1. 创建excel对应的实体对象 参照{@link IndexData} - *
  • 2. 使用{@link ExcelProperty}注解指定写入的列 - *
  • 3. 直接写即可 + *

    + * 1. 创建excel对应的实体对象 参照{@link IndexData} + *

    + * 2. 使用{@link ExcelProperty}注解指定写入的列 + *

    + * 3. 直接写即可 */ @Test public void indexWrite() { @@ -75,9 +80,12 @@ public class WriteTest { /** * 复杂头写入 - *

  • 1. 创建excel对应的实体对象 参照{@link ComplexHeadData} - *
  • 2. 使用{@link ExcelProperty}注解指定复杂的头 - *
  • 3. 直接写即可 + *

    + * 1. 创建excel对应的实体对象 参照{@link ComplexHeadData} + *

    + * 2. 使用{@link ExcelProperty}注解指定复杂的头 + *

    + * 3. 直接写即可 */ @Test public void complexHeadWrite() { @@ -88,9 +96,12 @@ public class WriteTest { /** * 重复多次写入 - *

  • 1. 创建excel对应的实体对象 参照{@link ComplexHeadData} - *
  • 2. 使用{@link ExcelProperty}注解指定复杂的头 - *
  • 3. 直接调用二次写入即可 + *

    + * 1. 创建excel对应的实体对象 参照{@link ComplexHeadData} + *

    + * 2. 使用{@link ExcelProperty}注解指定复杂的头 + *

    + * 3. 直接调用二次写入即可 */ @Test public void repeatedWrite() { @@ -108,9 +119,12 @@ public class WriteTest { /** * 日期、数字或者自定义格式转换 - *

  • 1. 创建excel对应的实体对象 参照{@link ConverterData} - *
  • 2. 使用{@link ExcelProperty}配合使用注解{@link DateTimeFormat}、{@link NumberFormat}或者自定义注解 - *
  • 3. 直接写即可 + *

    + * 1. 创建excel对应的实体对象 参照{@link ConverterData} + *

    + * 2. 使用{@link ExcelProperty}配合使用注解{@link DateTimeFormat}、{@link NumberFormat}或者自定义注解 + *

    + * 3. 直接写即可 */ @Test public void converterWrite() { @@ -121,8 +135,10 @@ public class WriteTest { /** * 图片导出 - *

  • 1. 创建excel对应的实体对象 参照{@link ImageData} - *
  • 2. 直接写即可 + *

    + * 1. 创建excel对应的实体对象 参照{@link ImageData} + *

    + * 2. 直接写即可 */ @Test public void imageWrite() throws Exception { @@ -150,10 +166,14 @@ public class WriteTest { /** * 根据模板写入 - *

  • 1. 创建excel对应的实体对象 参照{@link IndexData} - *
  • 2. 使用{@link ExcelProperty}注解指定写入的列 - *
  • 3. 使用withTemplate 读取模板 - *
  • 4. 直接写即可 + *

    + * 1. 创建excel对应的实体对象 参照{@link IndexData} + *

    + * 2. 使用{@link ExcelProperty}注解指定写入的列 + *

    + * 3. 使用withTemplate 读取模板 + *

    + * 4. 直接写即可 */ @Test public void templateWrite() { @@ -165,9 +185,12 @@ public class WriteTest { /** * 列宽、行高 - *

  • 1. 创建excel对应的实体对象 参照{@link WidthAndHeightData} - *
  • 2. 使用注解{@link ColumnWidth}、{@link HeadRowHeight}、{@link ContentRowHeight}指定宽度或高度 - *
  • 3. 直接写即可 + *

    + * 1. 创建excel对应的实体对象 参照{@link WidthAndHeightData} + *

    + * 2. 使用注解{@link ColumnWidth}、{@link HeadRowHeight}、{@link ContentRowHeight}指定宽度或高度 + *

    + * 3. 直接写即可 */ @Test public void widthAndHeightWrite() { @@ -178,9 +201,12 @@ public class WriteTest { /** * 自定义样式 - *

  • 1. 创建excel对应的实体对象 参照{@link DemoData} - *
  • 2. 创建一个style策略 并注册 - *
  • 3. 直接写即可 + *

    + * 1. 创建excel对应的实体对象 参照{@link DemoData} + *

    + * 2. 创建一个style策略 并注册 + *

    + * 3. 直接写即可 */ @Test public void styleWrite() { @@ -213,9 +239,12 @@ public class WriteTest { /** * 合并单元格 - *

  • 1. 创建excel对应的实体对象 参照{@link DemoData} - *
  • 2. 创建一个merge策略 并注册 - *
  • 3. 直接写即可 + *

    + * 1. 创建excel对应的实体对象 参照{@link DemoData} + *

    + * 2. 创建一个merge策略 并注册 + *

    + * 3. 直接写即可 */ @Test public void mergeWrite() { @@ -228,8 +257,10 @@ public class WriteTest { /** * 使用table去写入 - *

  • 1. 创建excel对应的实体对象 参照{@link DemoData} - *
  • 2. 然后写入table即可 + *

    + * 1. 创建excel对应的实体对象 参照{@link DemoData} + *

    + * 2. 然后写入table即可 */ @Test public void tableWrite() { @@ -255,8 +286,10 @@ public class WriteTest { *

    * 思路是这样子的,先创建List头格式的sheet仅仅写入头,然后通过table 不写入头的方式 去写入数据 * - *

  • 1. 创建excel对应的实体对象 参照{@link DemoData} - *
  • 2. 然后写入table即可 + *

    + * 1. 创建excel对应的实体对象 参照{@link DemoData} + *

    + * 2. 然后写入table即可 */ @Test public void dynamicHeadWrite() { @@ -277,9 +310,12 @@ public class WriteTest { *

    * poi 自带{@link SXSSFSheet#autoSizeColumn(int)} 对中文支持也不太好。目前没找到很好的算法。 有的话可以推荐下。 * - *

  • 1. 创建excel对应的实体对象 参照{@link DemoData} - *
  • 3. 注册策略{@link LongestMatchColumnWidthStyleStrategy} - *
  • 2. 直接写即可 + *

    + * 1. 创建excel对应的实体对象 参照{@link DemoData} + *

    + * 3. 注册策略{@link LongestMatchColumnWidthStyleStrategy} + *

    + * 2. 直接写即可 */ @Test public void longestMatchColumnWidthWrite() {