> getHead() {
return head;
}
@@ -88,4 +95,12 @@ public class BasicParameter {
public void setLocale(Locale locale) {
this.locale = locale;
}
+
+ public Boolean getUseScientificFormat() {
+ return useScientificFormat;
+ }
+
+ public void setUseScientificFormat(Boolean useScientificFormat) {
+ this.useScientificFormat = useScientificFormat;
+ }
}
diff --git a/src/main/java/com/alibaba/excel/metadata/GlobalConfiguration.java b/src/main/java/com/alibaba/excel/metadata/GlobalConfiguration.java
index 12cc8d3..26f3720 100644
--- a/src/main/java/com/alibaba/excel/metadata/GlobalConfiguration.java
+++ b/src/main/java/com/alibaba/excel/metadata/GlobalConfiguration.java
@@ -25,6 +25,12 @@ public class GlobalConfiguration {
* used when formatting dates and numbers.
*/
private Locale locale;
+ /**
+ * Whether to use scientific Format.
+ *
+ * default is false
+ */
+ private Boolean useScientificFormat;
public Boolean getUse1904windowing() {
return use1904windowing;
@@ -49,4 +55,12 @@ public class GlobalConfiguration {
public void setLocale(Locale locale) {
this.locale = locale;
}
+
+ public Boolean getUseScientificFormat() {
+ return useScientificFormat;
+ }
+
+ public void setUseScientificFormat(Boolean useScientificFormat) {
+ this.useScientificFormat = useScientificFormat;
+ }
}
diff --git a/src/main/java/com/alibaba/excel/metadata/DataFormatter.java b/src/main/java/com/alibaba/excel/metadata/format/DataFormatter.java
similarity index 96%
rename from src/main/java/com/alibaba/excel/metadata/DataFormatter.java
rename to src/main/java/com/alibaba/excel/metadata/format/DataFormatter.java
index 7467cd2..0bc70d1 100644
--- a/src/main/java/com/alibaba/excel/metadata/DataFormatter.java
+++ b/src/main/java/com/alibaba/excel/metadata/format/DataFormatter.java
@@ -15,7 +15,7 @@
* can be found in svn at location root/projects/3rd-party/src
* ====================================================================
*/
-package com.alibaba.excel.metadata;
+package com.alibaba.excel.metadata.format;
import java.math.BigDecimal;
import java.math.RoundingMode;
@@ -35,12 +35,12 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.poi.ss.usermodel.DateUtil;
-import org.apache.poi.ss.usermodel.ExcelGeneralNumberFormat;
import org.apache.poi.ss.usermodel.ExcelStyleDateFormatter;
import org.apache.poi.ss.usermodel.FractionFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.util.DateUtils;
/**
@@ -138,21 +138,32 @@ public class DataFormatter {
* @return
*/
private Boolean use1904windowing;
-
/**
- * Creates a formatter using the {@link Locale#getDefault() default locale}.
+ * Whether to use scientific Format.
+ *
+ * default is false
*/
- public DataFormatter() {
- this(null, null);
- }
+ private Boolean useScientificFormat;
/**
* Creates a formatter using the given locale.
*
*/
- public DataFormatter(Locale locale, Boolean use1904windowing) {
- this.use1904windowing = use1904windowing != null ? use1904windowing : Boolean.FALSE;
- this.locale = locale != null ? locale : Locale.getDefault();
+ public DataFormatter(GlobalConfiguration globalConfiguration) {
+ if (globalConfiguration == null) {
+ this.use1904windowing = Boolean.FALSE;
+ this.locale = Locale.getDefault();
+ this.useScientificFormat = Boolean.FALSE;
+ } else {
+ this.use1904windowing =
+ globalConfiguration.getUse1904windowing() != null ? globalConfiguration.getUse1904windowing()
+ : Boolean.FALSE;
+ this.locale =
+ globalConfiguration.getLocale() != null ? globalConfiguration.getLocale() : Locale.getDefault();
+ this.useScientificFormat =
+ globalConfiguration.getUseScientificFormat() != null ? globalConfiguration.getUseScientificFormat()
+ : Boolean.FALSE;
+ }
this.dateSymbols = DateFormatSymbols.getInstance(this.locale);
this.decimalSymbols = DecimalFormatSymbols.getInstance(this.locale);
}
@@ -532,7 +543,7 @@ public class DataFormatter {
return defaultNumFormat;
// otherwise use general format
}
- defaultNumFormat = new ExcelGeneralNumberFormat(locale);
+ defaultNumFormat = new ExcelGeneralNumberFormat(locale, useScientificFormat);
return defaultNumFormat;
}
diff --git a/src/main/java/com/alibaba/excel/metadata/format/ExcelGeneralNumberFormat.java b/src/main/java/com/alibaba/excel/metadata/format/ExcelGeneralNumberFormat.java
new file mode 100644
index 0000000..cdeb5e8
--- /dev/null
+++ b/src/main/java/com/alibaba/excel/metadata/format/ExcelGeneralNumberFormat.java
@@ -0,0 +1,81 @@
+package com.alibaba.excel.metadata.format;
+
+import java.math.BigDecimal;
+import java.math.MathContext;
+import java.math.RoundingMode;
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.text.FieldPosition;
+import java.text.Format;
+import java.text.ParsePosition;
+import java.util.Locale;
+
+import org.apache.poi.ss.usermodel.DataFormatter;
+
+/**
+ * Written with reference to {@link org.apache.poi.ss.usermodel.ExcelGeneralNumberFormat }.
+ *
+ * Supported Do not use scientific notation.
+ *
+ * @author JiaJu Zhuang
+ **/
+public class ExcelGeneralNumberFormat extends Format {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final MathContext TO_10_SF = new MathContext(10, RoundingMode.HALF_UP);
+
+ private final DecimalFormatSymbols decimalSymbols;
+ private final DecimalFormat integerFormat;
+ private final DecimalFormat decimalFormat;
+ private final DecimalFormat scientificFormat;
+
+ public ExcelGeneralNumberFormat(final Locale locale, final boolean useScientificFormat) {
+ decimalSymbols = DecimalFormatSymbols.getInstance(locale);
+ // Supported Do not use scientific notation.
+ if (useScientificFormat) {
+ scientificFormat = new DecimalFormat("0.#####E0", decimalSymbols);
+ } else {
+ scientificFormat = new DecimalFormat("#", decimalSymbols);
+ }
+ org.apache.poi.ss.usermodel.DataFormatter.setExcelStyleRoundingMode(scientificFormat);
+ integerFormat = new DecimalFormat("#", decimalSymbols);
+ org.apache.poi.ss.usermodel.DataFormatter.setExcelStyleRoundingMode(integerFormat);
+ decimalFormat = new DecimalFormat("#.##########", decimalSymbols);
+ DataFormatter.setExcelStyleRoundingMode(decimalFormat);
+ }
+
+ @Override
+ public StringBuffer format(Object number, StringBuffer toAppendTo, FieldPosition pos) {
+ final double value;
+ if (number instanceof Number) {
+ value = ((Number) number).doubleValue();
+ if (Double.isInfinite(value) || Double.isNaN(value)) {
+ return integerFormat.format(number, toAppendTo, pos);
+ }
+ } else {
+ // testBug54786 gets here with a date, so retain previous behaviour
+ return integerFormat.format(number, toAppendTo, pos);
+ }
+
+ final double abs = Math.abs(value);
+ if (abs >= 1E11 || (abs <= 1E-10 && abs > 0)) {
+ return scientificFormat.format(number, toAppendTo, pos);
+ } else if (Math.floor(value) == value || abs >= 1E10) {
+ // integer, or integer portion uses all 11 allowed digits
+ return integerFormat.format(number, toAppendTo, pos);
+ }
+ // Non-integers of non-scientific magnitude are formatted as "up to 11
+ // numeric characters, with the decimal point counting as a numeric
+ // character". We know there is a decimal point, so limit to 10 digits.
+ // https://support.microsoft.com/en-us/kb/65903
+ final double rounded = new BigDecimal(value).round(TO_10_SF).doubleValue();
+ return decimalFormat.format(rounded, toAppendTo, pos);
+ }
+
+ @Override
+ public Object parseObject(String source, ParsePosition pos) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/src/main/java/com/alibaba/excel/metadata/property/ExcelHeadProperty.java b/src/main/java/com/alibaba/excel/metadata/property/ExcelHeadProperty.java
index 34109ad..5a03577 100644
--- a/src/main/java/com/alibaba/excel/metadata/property/ExcelHeadProperty.java
+++ b/src/main/java/com/alibaba/excel/metadata/property/ExcelHeadProperty.java
@@ -73,7 +73,7 @@ public class ExcelHeadProperty {
int headIndex = 0;
for (int i = 0; i < head.size(); i++) {
if (holder instanceof AbstractWriteHolder) {
- if (((AbstractWriteHolder)holder).ignore(null, i)) {
+ if (((AbstractWriteHolder) holder).ignore(null, i)) {
continue;
}
}
@@ -130,9 +130,8 @@ public class ExcelHeadProperty {
index++;
}
}
- if (!initOneColumnProperty(holder, index, field, Boolean.FALSE)) {
- index++;
- }
+ initOneColumnProperty(holder, index, field, Boolean.FALSE);
+ index++;
}
for (Map.Entry entry : customFiledMap.entrySet()) {
initOneColumnProperty(holder, entry.getKey(), entry.getValue(), Boolean.TRUE);
@@ -151,7 +150,7 @@ public class ExcelHeadProperty {
*/
private boolean initOneColumnProperty(Holder holder, int index, Field field, Boolean forceIndex) {
if (holder instanceof AbstractWriteHolder) {
- if (((AbstractWriteHolder)holder).ignore(field.getName(), index)) {
+ if (((AbstractWriteHolder) holder).ignore(field.getName(), index)) {
return true;
}
}
diff --git a/src/main/java/com/alibaba/excel/read/builder/AbstractExcelReaderParameterBuilder.java b/src/main/java/com/alibaba/excel/read/builder/AbstractExcelReaderParameterBuilder.java
index 4e5e370..29d676c 100644
--- a/src/main/java/com/alibaba/excel/read/builder/AbstractExcelReaderParameterBuilder.java
+++ b/src/main/java/com/alibaba/excel/read/builder/AbstractExcelReaderParameterBuilder.java
@@ -31,6 +31,19 @@ public abstract class AbstractExcelReaderParameterBuilderReadRowHolder.
*/
private RowTypeEnum tempRowType;
- /**
- * Ignore record.
- */
- private Boolean ignoreRecord;
/**
* Temp object index.
*/
@@ -33,7 +29,6 @@ public class XlsReadSheetHolder extends ReadSheetHolder {
public XlsReadSheetHolder(ReadSheet readSheet, ReadWorkbookHolder readWorkbookHolder) {
super(readSheet, readWorkbookHolder);
- ignoreRecord = Boolean.FALSE;
tempRowType = RowTypeEnum.EMPTY;
objectCacheMap = new HashMap(16);
}
@@ -46,13 +41,6 @@ public class XlsReadSheetHolder extends ReadSheetHolder {
this.tempRowType = tempRowType;
}
- public Boolean getIgnoreRecord() {
- return ignoreRecord;
- }
-
- public void setIgnoreRecord(Boolean ignoreRecord) {
- this.ignoreRecord = ignoreRecord;
- }
public Integer getTempObjectIndex() {
return tempObjectIndex;
diff --git a/src/main/java/com/alibaba/excel/read/metadata/holder/xls/XlsReadWorkbookHolder.java b/src/main/java/com/alibaba/excel/read/metadata/holder/xls/XlsReadWorkbookHolder.java
index 70c1c03..a8c86a7 100644
--- a/src/main/java/com/alibaba/excel/read/metadata/holder/xls/XlsReadWorkbookHolder.java
+++ b/src/main/java/com/alibaba/excel/read/metadata/holder/xls/XlsReadWorkbookHolder.java
@@ -42,6 +42,10 @@ public class XlsReadWorkbookHolder extends ReadWorkbookHolder {
* Sheet Index
*/
private Integer readSheetIndex;
+ /**
+ * Ignore record.
+ */
+ private Boolean ignoreRecord;
public XlsReadWorkbookHolder(ReadWorkbook readWorkbook) {
super(readWorkbook);
@@ -51,6 +55,7 @@ public class XlsReadWorkbookHolder extends ReadWorkbookHolder {
if (getGlobalConfiguration().getUse1904windowing() == null) {
getGlobalConfiguration().setUse1904windowing(Boolean.FALSE);
}
+ ignoreRecord = Boolean.FALSE;
}
public POIFSFileSystem getPoifsFileSystem() {
@@ -100,4 +105,12 @@ public class XlsReadWorkbookHolder extends ReadWorkbookHolder {
public void setReadSheetIndex(Integer readSheetIndex) {
this.readSheetIndex = readSheetIndex;
}
+
+ public Boolean getIgnoreRecord() {
+ return ignoreRecord;
+ }
+
+ public void setIgnoreRecord(Boolean ignoreRecord) {
+ this.ignoreRecord = ignoreRecord;
+ }
}
diff --git a/src/main/java/com/alibaba/excel/util/NumberDataFormatterUtils.java b/src/main/java/com/alibaba/excel/util/NumberDataFormatterUtils.java
index 5bceb4a..09d149b 100644
--- a/src/main/java/com/alibaba/excel/util/NumberDataFormatterUtils.java
+++ b/src/main/java/com/alibaba/excel/util/NumberDataFormatterUtils.java
@@ -1,6 +1,6 @@
package com.alibaba.excel.util;
-import com.alibaba.excel.metadata.DataFormatter;
+import com.alibaba.excel.metadata.format.DataFormatter;
import com.alibaba.excel.metadata.GlobalConfiguration;
/**
@@ -9,6 +9,7 @@ import com.alibaba.excel.metadata.GlobalConfiguration;
* @author Jiaju Zhuang
**/
public class NumberDataFormatterUtils {
+
/**
* Cache DataFormatter.
*/
@@ -18,8 +19,7 @@ public class NumberDataFormatterUtils {
* Format number data.
*
* @param data
- * @param dataFormat
- * Not null.
+ * @param dataFormat Not null.
* @param dataFormatString
* @param globalConfiguration
* @return
@@ -28,12 +28,7 @@ public class NumberDataFormatterUtils {
GlobalConfiguration globalConfiguration) {
DataFormatter dataFormatter = DATA_FORMATTER_THREAD_LOCAL.get();
if (dataFormatter == null) {
- if (globalConfiguration != null) {
- dataFormatter =
- new DataFormatter(globalConfiguration.getLocale(), globalConfiguration.getUse1904windowing());
- } else {
- dataFormatter = new DataFormatter();
- }
+ dataFormatter = new DataFormatter(globalConfiguration);
DATA_FORMATTER_THREAD_LOCAL.set(dataFormatter);
}
return dataFormatter.format(data, dataFormat, dataFormatString);
diff --git a/src/main/java/com/alibaba/excel/util/NumberUtils.java b/src/main/java/com/alibaba/excel/util/NumberUtils.java
index e687fbf..4257ff4 100644
--- a/src/main/java/com/alibaba/excel/util/NumberUtils.java
+++ b/src/main/java/com/alibaba/excel/util/NumberUtils.java
@@ -167,6 +167,7 @@ public class NumberUtils {
RoundingMode roundingMode = contentProperty.getNumberFormatProperty().getRoundingMode();
DecimalFormat decimalFormat = new DecimalFormat(format);
decimalFormat.setRoundingMode(roundingMode);
+ decimalFormat.setParseBigDecimal(true);
return decimalFormat.parse(string);
}
}
diff --git a/src/main/java/com/alibaba/excel/write/executor/ExcelWriteAddExecutor.java b/src/main/java/com/alibaba/excel/write/executor/ExcelWriteAddExecutor.java
index d25ee94..728703e 100644
--- a/src/main/java/com/alibaba/excel/write/executor/ExcelWriteAddExecutor.java
+++ b/src/main/java/com/alibaba/excel/write/executor/ExcelWriteAddExecutor.java
@@ -156,6 +156,7 @@ public class ExcelWriteAddExecutor extends AbstractExcelWriteExecutor {
boolean uselessData = !beanMap.containsKey(filedName) || beanMapHandledSet.contains(filedName)
|| ignoreMap.containsKey(filedName) || writeContext.currentWriteHolder().ignore(filedName, cellIndex);
if (uselessData) {
+ cellIndex++;
continue;
}
Object value = beanMap.get(filedName);
diff --git a/src/main/java/com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java b/src/main/java/com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java
index 1a42fde..29a037a 100644
--- a/src/main/java/com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java
+++ b/src/main/java/com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java
@@ -295,28 +295,9 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor {
default:
throw new ExcelGenerateException("The wrong direction.");
}
- Row row = sheet.getRow(lastRowIndex);
- if (row == null) {
- row = cachedSheet.getRow(lastRowIndex);
- if (row == null) {
- WriteHandlerUtils.beforeRowCreate(writeContext, lastRowIndex, null, Boolean.FALSE);
- if (fillConfig.getForceNewRow()) {
- row = cachedSheet.createRow(lastRowIndex);
- } else {
- row = sheet.createRow(lastRowIndex);
- }
- checkRowHeight(analysisCell, fillConfig, isOriginalCell, row);
- WriteHandlerUtils.afterRowCreate(writeContext, row, null, Boolean.FALSE);
- } else {
- checkRowHeight(analysisCell, fillConfig, isOriginalCell, row);
- }
- }
- Cell cell = row.getCell(lastColumnIndex);
- if (cell == null) {
- WriteHandlerUtils.beforeCellCreate(writeContext, row, null, lastColumnIndex, null, Boolean.FALSE);
- cell = row.createCell(lastColumnIndex);
- WriteHandlerUtils.afterCellCreate(writeContext, cell, null, null, Boolean.FALSE);
- }
+
+ Row row = createRowIfNecessary(sheet, cachedSheet, lastRowIndex, fillConfig, analysisCell, isOriginalCell);
+ Cell cell = createCellIfNecessary(row,lastColumnIndex);
Map collectionFieldStyleMap = collectionFieldStyleCache.get(currentUniqueDataFlag);
if (collectionFieldStyleMap == null) {
@@ -334,6 +315,45 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor {
return cell;
}
+ private Cell createCellIfNecessary(Row row, Integer lastColumnIndex) {
+ Cell cell = row.getCell(lastColumnIndex);
+ if (cell != null) {
+ return cell;
+ }
+ WriteHandlerUtils.beforeCellCreate(writeContext, row, null, lastColumnIndex, null, Boolean.FALSE);
+ cell = row.createCell(lastColumnIndex);
+ WriteHandlerUtils.afterCellCreate(writeContext, cell, null, null, Boolean.FALSE);
+ return cell;
+ }
+
+ private Row createRowIfNecessary(Sheet sheet, Sheet cachedSheet, Integer lastRowIndex, FillConfig fillConfig,
+ AnalysisCell analysisCell, boolean isOriginalCell) {
+ Row row = sheet.getRow(lastRowIndex);
+ if (row != null) {
+ return row;
+ }
+ row = cachedSheet.getRow(lastRowIndex);
+ if (row == null) {
+ WriteHandlerUtils.beforeRowCreate(writeContext, lastRowIndex, null, Boolean.FALSE);
+ if (fillConfig.getForceNewRow()) {
+ row = cachedSheet.createRow(lastRowIndex);
+ } else {
+ // The last row of the middle disk inside empty rows, resulting in cachedSheet can not get inside.
+ // Will throw Attempting to write a row[" + rownum + "] " + "in the range [0," + this._sh.getLastRowNum() + "] that is already written to disk.
+ try {
+ row = sheet.createRow(lastRowIndex);
+ } catch (IllegalArgumentException ignore) {
+ row = cachedSheet.createRow(lastRowIndex);
+ }
+ }
+ checkRowHeight(analysisCell, fillConfig, isOriginalCell, row);
+ WriteHandlerUtils.afterRowCreate(writeContext, row, null, Boolean.FALSE);
+ } else {
+ checkRowHeight(analysisCell, fillConfig, isOriginalCell, row);
+ }
+ return row;
+ }
+
private void checkRowHeight(AnalysisCell analysisCell, FillConfig fillConfig, boolean isOriginalCell, Row row) {
if (!analysisCell.getFirstRow() || !WriteDirectionEnum.VERTICAL.equals(fillConfig.getDirection())) {
return;
diff --git a/src/main/java/com/alibaba/excel/write/merge/AbstractMergeStrategy.java b/src/main/java/com/alibaba/excel/write/merge/AbstractMergeStrategy.java
new file mode 100644
index 0000000..2a2b7b6
--- /dev/null
+++ b/src/main/java/com/alibaba/excel/write/merge/AbstractMergeStrategy.java
@@ -0,0 +1,56 @@
+package com.alibaba.excel.write.merge;
+
+import java.util.List;
+
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+
+import com.alibaba.excel.metadata.CellData;
+import com.alibaba.excel.metadata.Head;
+import com.alibaba.excel.write.handler.CellWriteHandler;
+import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
+import com.alibaba.excel.write.metadata.holder.WriteTableHolder;
+
+/**
+ * Merge strategy
+ *
+ * @author Jiaju Zhuang
+ */
+public abstract class AbstractMergeStrategy implements CellWriteHandler {
+ @Override
+ public void beforeCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row,
+ Head head, Integer columnIndex, Integer relativeRowIndex, Boolean isHead) {
+
+ }
+
+ @Override
+ public void afterCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Cell cell,
+ Head head, Integer relativeRowIndex, Boolean isHead) {}
+
+ @Override
+ public void afterCellDataConverted(WriteSheetHolder writeSheetHolder,
+ WriteTableHolder writeTableHolder, CellData cellData, Cell cell, Head head, Integer relativeRowIndex,
+ Boolean isHead) {
+
+ }
+
+ @Override
+ public void afterCellDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder,
+ List cellDataList, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) {
+ if (isHead) {
+ return;
+ }
+ merge(writeSheetHolder.getSheet(), cell, head, relativeRowIndex);
+ }
+
+ /**
+ * merge
+ *
+ * @param sheet
+ * @param cell
+ * @param head
+ * @param relativeRowIndex
+ */
+ protected abstract void merge(Sheet sheet, Cell cell, Head head, Integer relativeRowIndex);
+}
diff --git a/src/main/java/com/alibaba/excel/write/metadata/holder/AbstractWriteHolder.java b/src/main/java/com/alibaba/excel/write/metadata/holder/AbstractWriteHolder.java
index 77d5d06..0fced0b 100644
--- a/src/main/java/com/alibaba/excel/write/metadata/holder/AbstractWriteHolder.java
+++ b/src/main/java/com/alibaba/excel/write/metadata/holder/AbstractWriteHolder.java
@@ -111,6 +111,10 @@ public abstract class AbstractWriteHolder extends AbstractHolder implements Writ
getGlobalConfiguration().setUse1904windowing(writeBasicParameter.getUse1904windowing());
}
+ if (writeBasicParameter.getUseScientificFormat() != null) {
+ throw new UnsupportedOperationException("Currently does not support setting useScientificFormat.");
+ }
+
if (writeBasicParameter.getNeedHead() == null) {
if (parentAbstractWriteHolder == null) {
this.needHead = Boolean.TRUE;
diff --git a/src/main/java/com/alibaba/excel/write/metadata/holder/WriteWorkbookHolder.java b/src/main/java/com/alibaba/excel/write/metadata/holder/WriteWorkbookHolder.java
index be557eb..8c84f1d 100644
--- a/src/main/java/com/alibaba/excel/write/metadata/holder/WriteWorkbookHolder.java
+++ b/src/main/java/com/alibaba/excel/write/metadata/holder/WriteWorkbookHolder.java
@@ -112,6 +112,7 @@ public class WriteWorkbookHolder extends AbstractWriteHolder {
*/
private Boolean writeExcelOnException;
+
public WriteWorkbookHolder(WriteWorkbook writeWorkbook) {
super(writeWorkbook, null, writeWorkbook.getConvertAllFiled());
this.writeWorkbook = writeWorkbook;
diff --git a/src/main/java/com/alibaba/excel/write/property/ExcelWriteHeadProperty.java b/src/main/java/com/alibaba/excel/write/property/ExcelWriteHeadProperty.java
index 8fe0349..979a775 100644
--- a/src/main/java/com/alibaba/excel/write/property/ExcelWriteHeadProperty.java
+++ b/src/main/java/com/alibaba/excel/write/property/ExcelWriteHeadProperty.java
@@ -39,6 +39,7 @@ import com.alibaba.excel.metadata.property.StyleProperty;
* @author jipengfei
*/
public class ExcelWriteHeadProperty extends ExcelHeadProperty {
+
private RowHeightProperty headRowHeightProperty;
private RowHeightProperty contentRowHeightProperty;
private OnceAbsoluteMergeProperty onceAbsoluteMergeProperty;
@@ -49,21 +50,25 @@ public class ExcelWriteHeadProperty extends ExcelHeadProperty {
return;
}
this.headRowHeightProperty =
- RowHeightProperty.build((HeadRowHeight)headClazz.getAnnotation(HeadRowHeight.class));
+ RowHeightProperty.build((HeadRowHeight) headClazz.getAnnotation(HeadRowHeight.class));
this.contentRowHeightProperty =
- RowHeightProperty.build((ContentRowHeight)headClazz.getAnnotation(ContentRowHeight.class));
+ RowHeightProperty.build((ContentRowHeight) headClazz.getAnnotation(ContentRowHeight.class));
this.onceAbsoluteMergeProperty =
- OnceAbsoluteMergeProperty.build((OnceAbsoluteMerge)headClazz.getAnnotation(OnceAbsoluteMerge.class));
+ OnceAbsoluteMergeProperty.build((OnceAbsoluteMerge) headClazz.getAnnotation(OnceAbsoluteMerge.class));
- ColumnWidth parentColumnWidth = (ColumnWidth)headClazz.getAnnotation(ColumnWidth.class);
- HeadStyle parentHeadStyle = (HeadStyle)headClazz.getAnnotation(HeadStyle.class);
- HeadFontStyle parentHeadFontStyle = (HeadFontStyle)headClazz.getAnnotation(HeadFontStyle.class);
- ContentStyle parentContentStyle = (ContentStyle)headClazz.getAnnotation(ContentStyle.class);
- ContentFontStyle parentContentFontStyle = (ContentFontStyle)headClazz.getAnnotation(ContentFontStyle.class);
+ ColumnWidth parentColumnWidth = (ColumnWidth) headClazz.getAnnotation(ColumnWidth.class);
+ HeadStyle parentHeadStyle = (HeadStyle) headClazz.getAnnotation(HeadStyle.class);
+ HeadFontStyle parentHeadFontStyle = (HeadFontStyle) headClazz.getAnnotation(HeadFontStyle.class);
+ ContentStyle parentContentStyle = (ContentStyle) headClazz.getAnnotation(ContentStyle.class);
+ ContentFontStyle parentContentFontStyle = (ContentFontStyle) headClazz.getAnnotation(ContentFontStyle.class);
for (Map.Entry entry : getContentPropertyMap().entrySet()) {
Integer index = entry.getKey();
ExcelContentProperty excelContentPropertyData = entry.getValue();
+ if (excelContentPropertyData == null) {
+ throw new IllegalArgumentException(
+ "Passing in the class and list the head, the two must be the same size.");
+ }
Field field = excelContentPropertyData.getField();
Head headData = getHeadMap().get(index);
ColumnWidth columnWidth = field.getAnnotation(ColumnWidth.class);
@@ -176,7 +181,8 @@ public class ExcelWriteHeadProperty extends ExcelHeadProperty {
if (j == lastRow && i == lastCol) {
continue;
}
- cellRangeList.add(new CellRange(j, lastRow, i, lastCol));
+ cellRangeList
+ .add(new CellRange(j, lastRow, head.getColumnIndex(), headList.get(lastCol).getColumnIndex()));
}
}
return cellRangeList;
diff --git a/src/main/java/com/alibaba/excel/write/style/AbstractCellStyleStrategy.java b/src/main/java/com/alibaba/excel/write/style/AbstractCellStyleStrategy.java
index 06a596f..14ad9ce 100644
--- a/src/main/java/com/alibaba/excel/write/style/AbstractCellStyleStrategy.java
+++ b/src/main/java/com/alibaba/excel/write/style/AbstractCellStyleStrategy.java
@@ -22,6 +22,7 @@ import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder;
* @author Jiaju Zhuang
*/
public abstract class AbstractCellStyleStrategy implements CellWriteHandler, WorkbookWriteHandler, NotRepeatExecutor {
+
boolean hasInitialized = false;
@Override
@@ -50,7 +51,7 @@ public abstract class AbstractCellStyleStrategy implements CellWriteHandler, Wor
@Override
public void afterCellDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder,
List cellDataList, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) {
- if (isHead == null || head == null) {
+ if (isHead == null) {
return;
}
if (isHead) {
diff --git a/src/main/java/com/alibaba/excel/write/style/AbstractVerticalCellStyleStrategy.java b/src/main/java/com/alibaba/excel/write/style/AbstractVerticalCellStyleStrategy.java
index 09903a0..197c5cf 100644
--- a/src/main/java/com/alibaba/excel/write/style/AbstractVerticalCellStyleStrategy.java
+++ b/src/main/java/com/alibaba/excel/write/style/AbstractVerticalCellStyleStrategy.java
@@ -12,7 +12,6 @@ import com.alibaba.excel.util.StyleUtil;
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
/**
- *
* Use the same style for the column
*
* @author Jiaju Zhuang
@@ -30,6 +29,9 @@ public abstract class AbstractVerticalCellStyleStrategy extends AbstractCellStyl
@Override
protected void setHeadCellStyle(Cell cell, Head head, Integer relativeRowIndex) {
+ if (head == null) {
+ return;
+ }
int columnIndex = head.getColumnIndex();
if (headCellStyleCache.containsKey(columnIndex)) {
CellStyle cellStyle = headCellStyleCache.get(columnIndex);
@@ -50,6 +52,9 @@ public abstract class AbstractVerticalCellStyleStrategy extends AbstractCellStyl
@Override
protected void setContentCellStyle(Cell cell, Head head, Integer relativeRowIndex) {
+ if (head == null) {
+ return;
+ }
int columnIndex = head.getColumnIndex();
if (contentCellStyleCache.containsKey(columnIndex)) {
CellStyle cellStyle = contentCellStyleCache.get(columnIndex);
@@ -71,8 +76,7 @@ public abstract class AbstractVerticalCellStyleStrategy extends AbstractCellStyl
/**
* Returns the column width corresponding to each column head
*
- * @param head
- * Nullable
+ * @param head Nullable
* @return
*/
protected abstract WriteCellStyle headCellStyle(Head head);
@@ -80,8 +84,7 @@ public abstract class AbstractVerticalCellStyleStrategy extends AbstractCellStyl
/**
* Returns the column width corresponding to each column head
*
- * @param head
- * Nullable
+ * @param head Nullable
* @return
*/
protected abstract WriteCellStyle contentCellStyle(Head head);
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 edcf8a0..ea011b3 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
@@ -27,6 +27,7 @@ import com.alibaba.fastjson.JSON;
*/
@Ignore
public class ReadTest {
+
private static final Logger LOGGER = LoggerFactory.getLogger(ReadTest.class);
/**
@@ -48,11 +49,17 @@ public class ReadTest {
// 写法2:
fileName = TestFileUtil.getPath() + "demo" + File.separator + "demo.xlsx";
- ExcelReader excelReader = EasyExcel.read(fileName, DemoData.class, new DemoDataListener()).build();
- ReadSheet readSheet = EasyExcel.readSheet(0).build();
- excelReader.read(readSheet);
- // 这里千万别忘记关闭,读的时候会创建临时文件,到时磁盘会崩的
- excelReader.finish();
+ ExcelReader excelReader = null;
+ try {
+ excelReader = EasyExcel.read(fileName, DemoData.class, new DemoDataListener()).build();
+ ReadSheet readSheet = EasyExcel.readSheet(0).build();
+ excelReader.read(readSheet);
+ } finally {
+ if (excelReader != null) {
+ // 这里千万别忘记关闭,读的时候会创建临时文件,到时磁盘会崩的
+ excelReader.finish();
+ }
+ }
}
/**
@@ -90,16 +97,23 @@ public class ReadTest {
// 读取部分sheet
fileName = TestFileUtil.getPath() + "demo" + File.separator + "demo.xlsx";
- ExcelReader excelReader = EasyExcel.read(fileName).build();
- // 这里为了简单 所以注册了 同样的head 和Listener 自己使用功能必须不同的Listener
- ReadSheet readSheet1 =
- EasyExcel.readSheet(0).head(DemoData.class).registerReadListener(new DemoDataListener()).build();
- ReadSheet readSheet2 =
- EasyExcel.readSheet(1).head(DemoData.class).registerReadListener(new DemoDataListener()).build();
- // 这里注意 一定要把sheet1 sheet2 一起传进去,不然有个问题就是03版的excel 会读取多次,浪费性能
- excelReader.read(readSheet1, readSheet2);
- // 这里千万别忘记关闭,读的时候会创建临时文件,到时磁盘会崩的
- excelReader.finish();
+ ExcelReader excelReader = null;
+ try {
+ excelReader = EasyExcel.read(fileName).build();
+
+ // 这里为了简单 所以注册了 同样的head 和Listener 自己使用功能必须不同的Listener
+ ReadSheet readSheet1 =
+ EasyExcel.readSheet(0).head(DemoData.class).registerReadListener(new DemoDataListener()).build();
+ ReadSheet readSheet2 =
+ EasyExcel.readSheet(1).head(DemoData.class).registerReadListener(new DemoDataListener()).build();
+ // 这里注意 一定要把sheet1 sheet2 一起传进去,不然有个问题就是03版的excel 会读取多次,浪费性能
+ excelReader.read(readSheet1, readSheet2);
+ } finally {
+ if (excelReader != null) {
+ // 这里千万别忘记关闭,读的时候会创建临时文件,到时磁盘会崩的
+ excelReader.finish();
+ }
+ }
}
/**
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 7139fa8..ee9ce2f 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
@@ -40,6 +40,7 @@ import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy
*/
@Ignore
public class WriteTest {
+
/**
* 最简单的写
*
@@ -58,11 +59,17 @@ public class WriteTest {
// 写法2
fileName = TestFileUtil.getPath() + "simpleWrite" + System.currentTimeMillis() + ".xlsx";
// 这里 需要指定写用哪个class去写
- ExcelWriter excelWriter = EasyExcel.write(fileName, DemoData.class).build();
- WriteSheet writeSheet = EasyExcel.writerSheet("模板").build();
- excelWriter.write(data(), writeSheet);
- /// 千万别忘记finish 会帮忙关闭流
- excelWriter.finish();
+ ExcelWriter excelWriter = null;
+ try {
+ excelWriter = EasyExcel.write(fileName, DemoData.class).build();
+ WriteSheet writeSheet = EasyExcel.writerSheet("模板").build();
+ excelWriter.write(data(), writeSheet);
+ } finally {
+ // 千万别忘记finish 会帮忙关闭流
+ if (excelWriter != null) {
+ excelWriter.finish();
+ }
+ }
}
/**
@@ -141,48 +148,64 @@ public class WriteTest {
public void repeatedWrite() {
// 方法1 如果写到同一个sheet
String fileName = TestFileUtil.getPath() + "repeatedWrite" + System.currentTimeMillis() + ".xlsx";
- // 这里 需要指定写用哪个class去写
- ExcelWriter excelWriter = EasyExcel.write(fileName, DemoData.class).build();
- // 这里注意 如果同一个sheet只要创建一次
- WriteSheet writeSheet = EasyExcel.writerSheet("模板").build();
- // 去调用写入,这里我调用了五次,实际使用时根据数据库分页的总的页数来
- for (int i = 0; i < 5; i++) {
- // 分页去数据库查询数据 这里可以去数据库查询每一页的数据
- List data = data();
- excelWriter.write(data, writeSheet);
+ ExcelWriter excelWriter = null;
+ try {
+ // 这里 需要指定写用哪个class去写
+ excelWriter = EasyExcel.write(fileName, DemoData.class).build();
+ // 这里注意 如果同一个sheet只要创建一次
+ WriteSheet writeSheet = EasyExcel.writerSheet("模板").build();
+ // 去调用写入,这里我调用了五次,实际使用时根据数据库分页的总的页数来
+ for (int i = 0; i < 5; i++) {
+ // 分页去数据库查询数据 这里可以去数据库查询每一页的数据
+ List data = data();
+ excelWriter.write(data, writeSheet);
+ }
+ } finally {
+ // 千万别忘记finish 会帮忙关闭流
+ if (excelWriter != null) {
+ excelWriter.finish();
+ }
}
- /// 千万别忘记finish 会帮忙关闭流
- excelWriter.finish();
// 方法2 如果写到不同的sheet 同一个对象
fileName = TestFileUtil.getPath() + "repeatedWrite" + System.currentTimeMillis() + ".xlsx";
- // 这里 指定文件
- excelWriter = EasyExcel.write(fileName, DemoData.class).build();
- // 去调用写入,这里我调用了五次,实际使用时根据数据库分页的总的页数来。这里最终会写到5个sheet里面
- for (int i = 0; i < 5; i++) {
- // 每次都要创建writeSheet 这里注意必须指定sheetNo 而且sheetName必须不一样
- writeSheet = EasyExcel.writerSheet(i, "模板" + i).build();
- // 分页去数据库查询数据 这里可以去数据库查询每一页的数据
- List data = data();
- excelWriter.write(data, writeSheet);
+ try {
+ // 这里 指定文件
+ excelWriter = EasyExcel.write(fileName, DemoData.class).build();
+ // 去调用写入,这里我调用了五次,实际使用时根据数据库分页的总的页数来。这里最终会写到5个sheet里面
+ for (int i = 0; i < 5; i++) {
+ // 每次都要创建writeSheet 这里注意必须指定sheetNo 而且sheetName必须不一样
+ WriteSheet writeSheet = EasyExcel.writerSheet(i, "模板" + i).build();
+ // 分页去数据库查询数据 这里可以去数据库查询每一页的数据
+ List data = data();
+ excelWriter.write(data, writeSheet);
+ }
+ } finally {
+ // 千万别忘记finish 会帮忙关闭流
+ if (excelWriter != null) {
+ excelWriter.finish();
+ }
}
- /// 千万别忘记finish 会帮忙关闭流
- excelWriter.finish();
// 方法3 如果写到不同的sheet 不同的对象
fileName = TestFileUtil.getPath() + "repeatedWrite" + System.currentTimeMillis() + ".xlsx";
- // 这里 指定文件
- excelWriter = EasyExcel.write(fileName).build();
- // 去调用写入,这里我调用了五次,实际使用时根据数据库分页的总的页数来。这里最终会写到5个sheet里面
- for (int i = 0; i < 5; i++) {
- // 每次都要创建writeSheet 这里注意必须指定sheetNo 而且sheetName必须不一样。这里注意DemoData.class 可以每次都变,我这里为了方便 所以用的同一个class 实际上可以一直变
- writeSheet = EasyExcel.writerSheet(i, "模板" + i).head(DemoData.class).build();
- // 分页去数据库查询数据 这里可以去数据库查询每一页的数据
- List data = data();
- excelWriter.write(data, writeSheet);
+ try {
+ // 这里 指定文件
+ excelWriter = EasyExcel.write(fileName).build();
+ // 去调用写入,这里我调用了五次,实际使用时根据数据库分页的总的页数来。这里最终会写到5个sheet里面
+ for (int i = 0; i < 5; i++) {
+ // 每次都要创建writeSheet 这里注意必须指定sheetNo 而且sheetName必须不一样。这里注意DemoData.class 可以每次都变,我这里为了方便 所以用的同一个class 实际上可以一直变
+ WriteSheet writeSheet = EasyExcel.writerSheet(i, "模板" + i).head(DemoData.class).build();
+ // 分页去数据库查询数据 这里可以去数据库查询每一页的数据
+ List data = data();
+ excelWriter.write(data, writeSheet);
+ }
+ } finally {
+ // 千万别忘记finish 会帮忙关闭流
+ if (excelWriter != null) {
+ excelWriter.finish();
+ }
}
- /// 千万别忘记finish 会帮忙关闭流
- excelWriter.finish();
}
/**
@@ -302,7 +325,7 @@ public class WriteTest {
// 背景设置为红色
headWriteCellStyle.setFillForegroundColor(IndexedColors.RED.getIndex());
WriteFont headWriteFont = new WriteFont();
- headWriteFont.setFontHeightInPoints((short)20);
+ headWriteFont.setFontHeightInPoints((short) 20);
headWriteCellStyle.setWriteFont(headWriteFont);
// 内容的策略
WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
@@ -312,7 +335,7 @@ public class WriteTest {
contentWriteCellStyle.setFillForegroundColor(IndexedColors.GREEN.getIndex());
WriteFont contentWriteFont = new WriteFont();
// 字体大小
- contentWriteFont.setFontHeightInPoints((short)20);
+ contentWriteFont.setFontHeightInPoints((short) 20);
contentWriteCellStyle.setWriteFont(contentWriteFont);
// 这个策略是 头是头的样式 内容是内容的样式 其他的策略可以自己实现
HorizontalCellStyleStrategy horizontalCellStyleStrategy =
@@ -362,18 +385,24 @@ public class WriteTest {
String fileName = TestFileUtil.getPath() + "tableWrite" + System.currentTimeMillis() + ".xlsx";
// 这里直接写多个table的案例了,如果只有一个 也可以直一行代码搞定,参照其他案例
// 这里 需要指定写用哪个class去写
- ExcelWriter excelWriter = EasyExcel.write(fileName, DemoData.class).build();
- // 把sheet设置为不需要头 不然会输出sheet的头 这样看起来第一个table 就有2个头了
- WriteSheet writeSheet = EasyExcel.writerSheet("模板").needHead(Boolean.FALSE).build();
- // 这里必须指定需要头,table 会继承sheet的配置,sheet配置了不需要,table 默认也是不需要
- WriteTable writeTable0 = EasyExcel.writerTable(0).needHead(Boolean.TRUE).build();
- WriteTable writeTable1 = EasyExcel.writerTable(1).needHead(Boolean.TRUE).build();
- // 第一次写入会创建头
- excelWriter.write(data(), writeSheet, writeTable0);
- // 第二次写如也会创建头,然后在第一次的后面写入数据
- excelWriter.write(data(), writeSheet, writeTable1);
- /// 千万别忘记finish 会帮忙关闭流
- excelWriter.finish();
+ ExcelWriter excelWriter = null;
+ try {
+ EasyExcel.write(fileName, DemoData.class).build();
+ // 把sheet设置为不需要头 不然会输出sheet的头 这样看起来第一个table 就有2个头了
+ WriteSheet writeSheet = EasyExcel.writerSheet("模板").needHead(Boolean.FALSE).build();
+ // 这里必须指定需要头,table 会继承sheet的配置,sheet配置了不需要,table 默认也是不需要
+ WriteTable writeTable0 = EasyExcel.writerTable(0).needHead(Boolean.TRUE).build();
+ WriteTable writeTable1 = EasyExcel.writerTable(1).needHead(Boolean.TRUE).build();
+ // 第一次写入会创建头
+ excelWriter.write(data(), writeSheet, writeTable0);
+ // 第二次写如也会创建头,然后在第一次的后面写入数据
+ excelWriter.write(data(), writeSheet, writeTable1);
+ } finally {
+ // 千万别忘记finish 会帮忙关闭流
+ if (excelWriter != null) {
+ excelWriter.finish();
+ }
+ }
}
/**
@@ -399,8 +428,7 @@ public class WriteTest {
/**
* 自动列宽(不太精确)
*
- * 这个目前不是很好用,比如有数字就会导致换行。而且长度也不是刚好和实际长度一致。 所以需要精确到刚好列宽的慎用。 当然也可以自己参照
- * {@link LongestMatchColumnWidthStyleStrategy}重新实现.
+ * 这个目前不是很好用,比如有数字就会导致换行。而且长度也不是刚好和实际长度一致。 所以需要精确到刚好列宽的慎用。 当然也可以自己参照 {@link LongestMatchColumnWidthStyleStrategy}重新实现.
*
* poi 自带{@link SXSSFSheet#autoSizeColumn(int)} 对中文支持也不太好。目前没找到很好的算法。 有的话可以推荐下。
*
diff --git a/src/test/java/com/alibaba/easyexcel/test/temp/FillTempTest.java b/src/test/java/com/alibaba/easyexcel/test/temp/FillTempTest.java
index 0ed625d..7917e06 100644
--- a/src/test/java/com/alibaba/easyexcel/test/temp/FillTempTest.java
+++ b/src/test/java/com/alibaba/easyexcel/test/temp/FillTempTest.java
@@ -13,6 +13,7 @@ import com.alibaba.easyexcel.test.temp.fill.FillData2;
import com.alibaba.easyexcel.test.util.TestFileUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
+import com.alibaba.excel.write.merge.OnceAbsoluteMergeStrategy;
import com.alibaba.excel.write.metadata.WriteSheet;
/**
@@ -33,16 +34,21 @@ public class FillTempTest {
public void complexFill() {
// 模板注意 用{} 来表示你要用的变量 如果本来就有"{","}" 特殊字符 用"\{","\}"代替
// {} 代表普通变量 {.} 代表是list的变量
- String templateFileName = "D:\\test\\simple.xlsx";
+ OnceAbsoluteMergeStrategy onceAbsoluteMergeStrategy = new OnceAbsoluteMergeStrategy(2, 2, 0, 1);
String fileName = TestFileUtil.getPath() + "complexFill" + System.currentTimeMillis() + ".xlsx";
- ExcelWriter excelWriter = EasyExcel.write(fileName).withTemplate(templateFileName).build();
- WriteSheet writeSheet = EasyExcel.writerSheet().build();
- excelWriter.fill(teamp(), writeSheet);
+ ExcelWriter excelWriter = EasyExcel.write(fileName).registerWriteHandler(onceAbsoluteMergeStrategy).withTemplate(TestFileUtil.readUserHomeFile("test/simple.xlsx")).build();
+ WriteSheet writeSheet0 = EasyExcel.writerSheet(0).build();
+ WriteSheet writeSheet1 = EasyExcel.writerSheet(1).build();
+
+ excelWriter.fill(teamp(), writeSheet0);
+ excelWriter.fill(teamp(), writeSheet1);
+
Map map = new HashMap();
map.put("date", "2019年10月9日13:28:28");
map.put("total", 1000);
- excelWriter.fill(map, writeSheet);
+ excelWriter.fill(map, writeSheet0);
+
excelWriter.finish();
}
diff --git a/src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java b/src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java
index c801077..0dcef53 100644
--- a/src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java
+++ b/src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java
@@ -28,19 +28,29 @@ import com.alibaba.fastjson.JSON;
**/
@Ignore
public class Lock2Test {
+
private static final Logger LOGGER = LoggerFactory.getLogger(Lock2Test.class);
@Test
public void test() throws Exception {
- File file = TestFileUtil.readUserHomeFile("test/t3.xls");
+ File file = TestFileUtil.readUserHomeFile("test/test6.xls");
- List