org.apache.commons
commons-csv
diff --git a/easyexcel-core/src/main/java/com/alibaba/excel/analysis/v07/XlsxSaxAnalyser.java b/easyexcel-core/src/main/java/com/alibaba/excel/analysis/v07/XlsxSaxAnalyser.java
index 5104b1e3..024789b8 100644
--- a/easyexcel-core/src/main/java/com/alibaba/excel/analysis/v07/XlsxSaxAnalyser.java
+++ b/easyexcel-core/src/main/java/com/alibaba/excel/analysis/v07/XlsxSaxAnalyser.java
@@ -31,7 +31,6 @@ import com.alibaba.excel.util.SheetUtils;
import com.alibaba.excel.util.StringUtils;
import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.openxml4j.opc.PackageAccess;
@@ -41,10 +40,9 @@ import org.apache.poi.openxml4j.opc.PackageRelationshipCollection;
import org.apache.poi.openxml4j.opc.PackagingURIHelper;
import org.apache.poi.ss.util.CellAddress;
import org.apache.poi.xssf.eventusermodel.XSSFReader;
+import org.apache.poi.xssf.model.Comments;
import org.apache.poi.xssf.model.CommentsTable;
-import org.apache.poi.xssf.model.SharedStringsTable;
import org.apache.poi.xssf.usermodel.XSSFComment;
-import org.apache.poi.xssf.usermodel.XSSFRelation;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbookPr;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.WorkbookDocument;
@@ -121,9 +119,9 @@ public class XlsxSaxAnalyser implements ExcelReadExecutor {
sheetList.add(new ReadSheet(index, ite.getSheetName()));
sheetMap.put(index, inputStream);
if (xlsxReadContext.readWorkbookHolder().getExtraReadSet().contains(CellExtraTypeEnum.COMMENT)) {
- CommentsTable commentsTable = ite.getSheetComments();
- if (null != commentsTable) {
- commentsTableMap.put(index, commentsTable);
+ Comments comments = ite.getSheetComments();
+ if (comments instanceof CommentsTable) {
+ commentsTableMap.put(index, (CommentsTable) comments);
}
}
if (xlsxReadContext.readWorkbookHolder().getExtraReadSet().contains(CellExtraTypeEnum.HYPERLINK)) {
@@ -179,7 +177,7 @@ public class XlsxSaxAnalyser implements ExcelReadExecutor {
}
private void analysisSharedStringsTable(InputStream sharedStringsTableInputStream,
- XlsxReadWorkbookHolder xlsxReadWorkbookHolder) throws Exception {
+ XlsxReadWorkbookHolder xlsxReadWorkbookHolder) {
ContentHandler handler = new SharedStringsTableHandler(xlsxReadWorkbookHolder.getReadCache());
parseXmlSource(sharedStringsTableInputStream, handler);
xlsxReadWorkbookHolder.getReadCache().putFinished();
@@ -199,7 +197,7 @@ public class XlsxSaxAnalyser implements ExcelReadExecutor {
}
File readTempFile = FileUtils.createCacheTmpFile();
xlsxReadWorkbookHolder.setTempFile(readTempFile);
- File tempFile = new File(readTempFile.getPath(), UUID.randomUUID().toString() + ".xlsx");
+ File tempFile = new File(readTempFile.getPath(), UUID.randomUUID() + ".xlsx");
if (decryptedStream != null) {
FileUtils.writeToFile(tempFile, decryptedStream, false);
} else {
diff --git a/easyexcel-core/src/main/java/com/alibaba/excel/metadata/csv/CsvCell.java b/easyexcel-core/src/main/java/com/alibaba/excel/metadata/csv/CsvCell.java
index 72beb30a..a75c5765 100644
--- a/easyexcel-core/src/main/java/com/alibaba/excel/metadata/csv/CsvCell.java
+++ b/easyexcel-core/src/main/java/com/alibaba/excel/metadata/csv/CsvCell.java
@@ -227,11 +227,6 @@ public class CsvCell extends CellBase {
return getCellType();
}
- @Override
- public CellType getCachedFormulaResultTypeEnum() {
- return getCellType();
- }
-
@Override
public String getCellFormula() {
if (formulaData == null) {
diff --git a/easyexcel-core/src/main/java/com/alibaba/excel/metadata/csv/CsvCellStyle.java b/easyexcel-core/src/main/java/com/alibaba/excel/metadata/csv/CsvCellStyle.java
index a992f213..7a2714a0 100644
--- a/easyexcel-core/src/main/java/com/alibaba/excel/metadata/csv/CsvCellStyle.java
+++ b/easyexcel-core/src/main/java/com/alibaba/excel/metadata/csv/CsvCellStyle.java
@@ -76,7 +76,7 @@ public class CsvCellStyle implements CellStyle {
}
@Override
- public short getFontIndex() {
+ public int getFontIndex() {
return 0;
}
@@ -125,11 +125,6 @@ public class CsvCellStyle implements CellStyle {
return null;
}
- @Override
- public HorizontalAlignment getAlignmentEnum() {
- return null;
- }
-
@Override
public void setWrapText(boolean wrapped) {
@@ -150,11 +145,6 @@ public class CsvCellStyle implements CellStyle {
return null;
}
- @Override
- public VerticalAlignment getVerticalAlignmentEnum() {
- return null;
- }
-
@Override
public void setRotation(short rotation) {
@@ -185,11 +175,6 @@ public class CsvCellStyle implements CellStyle {
return null;
}
- @Override
- public BorderStyle getBorderLeftEnum() {
- return null;
- }
-
@Override
public void setBorderRight(BorderStyle border) {
@@ -200,11 +185,6 @@ public class CsvCellStyle implements CellStyle {
return null;
}
- @Override
- public BorderStyle getBorderRightEnum() {
- return null;
- }
-
@Override
public void setBorderTop(BorderStyle border) {
@@ -215,11 +195,6 @@ public class CsvCellStyle implements CellStyle {
return null;
}
- @Override
- public BorderStyle getBorderTopEnum() {
- return null;
- }
-
@Override
public void setBorderBottom(BorderStyle border) {
@@ -230,11 +205,6 @@ public class CsvCellStyle implements CellStyle {
return null;
}
- @Override
- public BorderStyle getBorderBottomEnum() {
- return null;
- }
-
@Override
public void setLeftBorderColor(short color) {
@@ -286,12 +256,12 @@ public class CsvCellStyle implements CellStyle {
}
@Override
- public FillPatternType getFillPatternEnum() {
- return null;
+ public void setFillBackgroundColor(short bg) {
+
}
@Override
- public void setFillBackgroundColor(short bg) {
+ public void setFillBackgroundColor(Color color) {
}
@@ -310,6 +280,11 @@ public class CsvCellStyle implements CellStyle {
}
+ @Override
+ public void setFillForegroundColor(Color color) {
+
+ }
+
@Override
public short getFillForegroundColor() {
return 0;
diff --git a/easyexcel-core/src/main/java/com/alibaba/excel/metadata/csv/CsvSheet.java b/easyexcel-core/src/main/java/com/alibaba/excel/metadata/csv/CsvSheet.java
index 725addbc..317569e0 100644
--- a/easyexcel-core/src/main/java/com/alibaba/excel/metadata/csv/CsvSheet.java
+++ b/easyexcel-core/src/main/java/com/alibaba/excel/metadata/csv/CsvSheet.java
@@ -33,6 +33,8 @@ import org.apache.poi.ss.usermodel.Drawing;
import org.apache.poi.ss.usermodel.Footer;
import org.apache.poi.ss.usermodel.Header;
import org.apache.poi.ss.usermodel.Hyperlink;
+import org.apache.poi.ss.usermodel.PageMargin;
+import org.apache.poi.ss.usermodel.PaneType;
import org.apache.poi.ss.usermodel.PrintSetup;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
@@ -397,11 +399,21 @@ public class CsvSheet implements Sheet, Closeable {
return 0;
}
+ @Override
+ public double getMargin(PageMargin pageMargin) {
+ return 0;
+ }
+
@Override
public void setMargin(short margin, double size) {
}
+ @Override
+ public void setMargin(PageMargin pageMargin, double v) {
+
+ }
+
@Override
public boolean getProtect() {
return false;
@@ -467,6 +479,11 @@ public class CsvSheet implements Sheet, Closeable {
}
+ @Override
+ public void createSplitPane(int i, int i1, int i2, int i3, PaneType paneType) {
+
+ }
+
@Override
public PaneInformation getPaneInformation() {
return null;
diff --git a/easyexcel-core/src/main/java/com/alibaba/excel/metadata/csv/CsvWorkbook.java b/easyexcel-core/src/main/java/com/alibaba/excel/metadata/csv/CsvWorkbook.java
index 4e713509..f381d482 100644
--- a/easyexcel-core/src/main/java/com/alibaba/excel/metadata/csv/CsvWorkbook.java
+++ b/easyexcel-core/src/main/java/com/alibaba/excel/metadata/csv/CsvWorkbook.java
@@ -11,7 +11,9 @@ import lombok.Getter;
import lombok.Setter;
import org.apache.commons.compress.utils.Lists;
import org.apache.poi.ss.SpreadsheetVersion;
+import org.apache.poi.ss.formula.EvaluationWorkbook;
import org.apache.poi.ss.formula.udf.UDFFinder;
+import org.apache.poi.ss.usermodel.CellReferenceType;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.CreationHelper;
import org.apache.poi.ss.usermodel.DataFormat;
@@ -39,10 +41,9 @@ public class CsvWorkbook implements Workbook {
/**
* true if date uses 1904 windowing, or false if using 1900 date windowing.
- *
+ *
* default is false
*
- * @return
*/
private Boolean use1904windowing;
@@ -53,7 +54,7 @@ public class CsvWorkbook implements Workbook {
/**
* Whether to use scientific Format.
- *
+ *
* default is false
*/
private Boolean useScientificFormat;
@@ -185,7 +186,7 @@ public class CsvWorkbook implements Workbook {
}
@Override
- public short getNumberOfFonts() {
+ public int getNumberOfFonts() {
return 0;
}
@@ -194,11 +195,6 @@ public class CsvWorkbook implements Workbook {
return 0;
}
- @Override
- public Font getFontAt(short idx) {
- return null;
- }
-
@Override
public Font getFontAt(int idx) {
return null;
@@ -257,31 +253,11 @@ public class CsvWorkbook implements Workbook {
return null;
}
- @Override
- public Name getNameAt(int nameIndex) {
- return null;
- }
-
@Override
public Name createName() {
return null;
}
- @Override
- public int getNameIndex(String name) {
- return 0;
- }
-
- @Override
- public void removeName(int index) {
-
- }
-
- @Override
- public void removeName(String name) {
-
- }
-
@Override
public void removeName(Name name) {
@@ -402,10 +378,25 @@ public class CsvWorkbook implements Workbook {
}
@Override
- public int addOlePackage(byte[] oleData, String label, String fileName, String command) throws IOException {
+ public int addOlePackage(byte[] oleData, String label, String fileName, String command) {
return 0;
}
+ @Override
+ public EvaluationWorkbook createEvaluationWorkbook() {
+ return null;
+ }
+
+ @Override
+ public CellReferenceType getCellReferenceType() {
+ return null;
+ }
+
+ @Override
+ public void setCellReferenceType(CellReferenceType cellReferenceType) {
+
+ }
+
@Override
public Iterator iterator() {
return null;
diff --git a/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java b/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java
index 283ce133..6e85addf 100644
--- a/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java
+++ b/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java
@@ -28,7 +28,7 @@ import com.alibaba.fastjson2.JSON;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
-import org.apache.poi.hssf.util.CellReference;
+import org.apache.poi.ss.util.CellReference;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.IndexedColors;
diff --git a/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/temp/dataformat/DataFormatter1.java b/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/temp/dataformat/DataFormatter1.java
index c4dce8d3..05f3d09f 100644
--- a/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/temp/dataformat/DataFormatter1.java
+++ b/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/temp/dataformat/DataFormatter1.java
@@ -38,6 +38,7 @@ import java.util.Observer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import com.alibaba.excel.analysis.ExcelAnalyserImpl;
import org.apache.poi.ss.format.CellFormat;
import org.apache.poi.ss.format.CellFormatResult;
import org.apache.poi.ss.formula.ConditionalFormattingEvaluator;
@@ -54,8 +55,8 @@ import org.apache.poi.ss.usermodel.FractionFormat;
import org.apache.poi.ss.util.DateFormatConverter;
import org.apache.poi.ss.util.NumberToTextConverter;
import org.apache.poi.util.LocaleUtil;
-import org.apache.poi.util.POILogFactory;
-import org.apache.poi.util.POILogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* DataFormatter contains methods for formatting the value stored in an Cell. This can be useful for reports and GUI
@@ -227,7 +228,7 @@ public class DataFormatter1 implements Observer {
private final LocaleChangeObservable localeChangedObservable = new LocaleChangeObservable();
/** For logging any problems we find */
- private static POILogger logger = POILogFactory.getLogger(DataFormatter.class);
+ private static final Logger logger = LoggerFactory.getLogger(ExcelAnalyserImpl.class);
/**
* Creates a formatter using the {@link Locale#getDefault() default locale}.
@@ -346,7 +347,7 @@ public class DataFormatter1 implements Observer {
// Wrap and return (non-cachable - CellFormat does that)
return new CellFormatResultWrapper(cfmt.apply(cellValueO));
} catch (Exception e) {
- logger.log(POILogger.WARN, "Formatting failed for format " + formatStr + ", falling back", e);
+ logger.warn("Formatting failed for format {}, falling back", formatStr, e);
}
}
@@ -589,7 +590,7 @@ public class DataFormatter1 implements Observer {
try {
return new ExcelStyleDateFormatter(formatStr, dateSymbols);
} catch (IllegalArgumentException iae) {
- logger.log(POILogger.DEBUG, "Formatting failed for format " + formatStr + ", falling back", iae);
+ logger.debug("Formatting failed for format {}, falling back", formatStr, iae);
// the pattern could not be parsed correctly,
// so fall back to the default number format
return getDefaultFormat(cellValue);
@@ -750,7 +751,7 @@ public class DataFormatter1 implements Observer {
try {
return new InternalDecimalFormatWithScale(format, symbols);
} catch (IllegalArgumentException iae) {
- logger.log(POILogger.DEBUG, "Formatting failed for format " + formatStr + ", falling back", iae);
+ logger.debug("Formatting failed for format {}, falling back", formatStr, iae);
// the pattern could not be parsed correctly,
// so fall back to the default number format
return getDefaultFormat(cellValue);
diff --git a/pom.xml b/pom.xml
index cceb0f94..92ba60d5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -96,22 +96,17 @@
org.apache.poi
poi
- 4.1.2
+ 5.2.3
org.apache.poi
poi-ooxml
- 4.1.2
-
-
- org.apache.poi
- poi-ooxml-schemas
- 4.1.2
+ 5.2.3
org.apache.commons
commons-csv
- 1.8
+ 1.9.0
org.slf4j