Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

升级到poi5 #3835

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions easyexcel-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
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;
Expand Down Expand Up @@ -81,7 +82,7 @@ public class XlsxSaxAnalyser implements ExcelReadExecutor {
/**
* excel comments key: sheetNo value: CommentsTable
*/
private final Map<Integer, CommentsTable> commentsTableMap;
private final Map<Integer, Comments> commentsTableMap;

public XlsxSaxAnalyser(XlsxReadContext xlsxReadContext, InputStream decryptedStream) throws Exception {
this.xlsxReadContext = xlsxReadContext;
Expand Down Expand Up @@ -123,7 +124,7 @@ public XlsxSaxAnalyser(XlsxReadContext xlsxReadContext, InputStream decryptedStr
sheetList.add(new ReadSheet(index, ite.getSheetName()));
sheetMap.put(index, inputStream);
if (xlsxReadContext.readWorkbookHolder().getExtraReadSet().contains(CellExtraTypeEnum.COMMENT)) {
CommentsTable commentsTable = ite.getSheetComments();
Comments commentsTable = ite.getSheetComments();
if (null != commentsTable) {
commentsTableMap.put(index, commentsTable);
}
Expand Down Expand Up @@ -278,7 +279,7 @@ private void readComments(ReadSheet readSheet) {
if (!xlsxReadContext.readWorkbookHolder().getExtraReadSet().contains(CellExtraTypeEnum.COMMENT)) {
return;
}
CommentsTable commentsTable = commentsTableMap.get(readSheet.getSheetNo());
Comments commentsTable = commentsTableMap.get(readSheet.getSheetNo());
if (commentsTable == null) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,6 @@ public CellType getCachedFormulaResultType() {
return getCellType();
}

@Override
public CellType getCachedFormulaResultTypeEnum() {
return getCellType();
}

@Override
public String getCellFormula() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void setFont(Font font) {
}

@Override
public short getFontIndex() {
public int getFontIndex() {
return 0;
}

Expand Down Expand Up @@ -125,10 +125,6 @@ public HorizontalAlignment getAlignment() {
return null;
}

@Override
public HorizontalAlignment getAlignmentEnum() {
return null;
}

@Override
public void setWrapText(boolean wrapped) {
Expand All @@ -150,10 +146,6 @@ public VerticalAlignment getVerticalAlignment() {
return null;
}

@Override
public VerticalAlignment getVerticalAlignmentEnum() {
return null;
}

@Override
public void setRotation(short rotation) {
Expand Down Expand Up @@ -185,10 +177,6 @@ public BorderStyle getBorderLeft() {
return null;
}

@Override
public BorderStyle getBorderLeftEnum() {
return null;
}

@Override
public void setBorderRight(BorderStyle border) {
Expand All @@ -200,10 +188,6 @@ public BorderStyle getBorderRight() {
return null;
}

@Override
public BorderStyle getBorderRightEnum() {
return null;
}

@Override
public void setBorderTop(BorderStyle border) {
Expand All @@ -215,10 +199,6 @@ public BorderStyle getBorderTop() {
return null;
}

@Override
public BorderStyle getBorderTopEnum() {
return null;
}

@Override
public void setBorderBottom(BorderStyle border) {
Expand All @@ -230,10 +210,6 @@ public BorderStyle getBorderBottom() {
return null;
}

@Override
public BorderStyle getBorderBottomEnum() {
return null;
}

@Override
public void setLeftBorderColor(short color) {
Expand Down Expand Up @@ -285,13 +261,14 @@ public FillPatternType getFillPattern() {
return null;
}


@Override
public FillPatternType getFillPatternEnum() {
return null;
public void setFillBackgroundColor(short bg) {

}

@Override
public void setFillBackgroundColor(short bg) {
public void setFillBackgroundColor(Color color) {

}

Expand All @@ -310,6 +287,11 @@ public void setFillForegroundColor(short bg) {

}

@Override
public void setFillForegroundColor(Color color) {

}

@Override
public short getFillForegroundColor() {
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import java.io.Closeable;
import java.io.IOException;
import java.math.BigDecimal;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
Expand All @@ -16,34 +14,15 @@
import com.alibaba.excel.exception.ExcelGenerateException;
import com.alibaba.excel.util.DateUtils;
import com.alibaba.excel.util.ListUtils;
import com.alibaba.excel.util.MapUtils;
import com.alibaba.excel.util.NumberDataFormatterUtils;
import com.alibaba.excel.util.StringUtils;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVPrinter;
import org.apache.commons.io.ByteOrderMark;
import org.apache.poi.ss.usermodel.AutoFilter;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellRange;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Comment;
import org.apache.poi.ss.usermodel.DataValidation;
import org.apache.poi.ss.usermodel.DataValidationHelper;
import org.apache.poi.ss.usermodel.DateUtil;
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.PrintSetup;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.SheetConditionalFormatting;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellAddress;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.ss.util.PaneInformation;
Expand Down Expand Up @@ -411,11 +390,21 @@ public double getMargin(short margin) {
return 0;
}

@Override
public double getMargin(PageMargin margin) {
return 0;
}

@Override
public void setMargin(short margin, double size) {

}

@Override
public void setMargin(PageMargin margin, double size) {

}

@Override
public boolean getProtect() {
return false;
Expand Down Expand Up @@ -481,6 +470,11 @@ public void createSplitPane(int xSplitPos, int ySplitPos, int leftmostColumn, in

}

@Override
public void createSplitPane(int xSplitPos, int ySplitPos, int leftmostColumn, int topRow, PaneType activePane) {

}

@Override
public PaneInformation getPaneInformation() {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,10 @@
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.CellStyle;
import org.apache.poi.ss.usermodel.CreationHelper;
import org.apache.poi.ss.usermodel.DataFormat;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.Name;
import org.apache.poi.ss.usermodel.PictureData;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.usermodel.Row.MissingCellPolicy;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.SheetVisibility;
import org.apache.poi.ss.usermodel.Workbook;

/**
* csv workbook
Expand Down Expand Up @@ -200,7 +193,7 @@ public Font findFont(boolean bold, short color, short fontHeight, String name, b
}

@Override
public short getNumberOfFonts() {
public int getNumberOfFonts() {
return 0;
}

Expand All @@ -209,10 +202,6 @@ public int getNumberOfFontsAsInt() {
return 0;
}

@Override
public Font getFontAt(short idx) {
return null;
}

@Override
public Font getFontAt(int idx) {
Expand Down Expand Up @@ -272,30 +261,16 @@ public List<? extends Name> getAllNames() {
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) {
Expand Down Expand Up @@ -421,6 +396,21 @@ public int addOlePackage(byte[] oleData, String label, String fileName, String c
return 0;
}

@Override
public EvaluationWorkbook createEvaluationWorkbook() {
return null;
}

@Override
public CellReferenceType getCellReferenceType() {
return null;
}

@Override
public void setCellReferenceType(CellReferenceType cellReferenceType) {

}

@Override
public Iterator<Sheet> iterator() {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.hssf.util.CellReference;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.util.CellReference;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,12 @@
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson2.JSON;

import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.crypt.Decryptor;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.ss.usermodel.BuiltinFormats;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.DataFormatter;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.ExcelStyleDateFormatter;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.apache.poi.ss.usermodel.*;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -180,7 +171,7 @@ public void testFormatter3() throws Exception {
private void isDate(Cell cell) {
System.out.println(
DateUtil.isADateFormat(cell.getCellStyle().getDataFormat(), cell.getCellStyle().getDataFormatString()));
System.out.println(HSSFDateUtil.isCellDateFormatted(cell));
System.out.println(DateUtil.isCellDateFormatted(cell));
DataFormatter f = new DataFormatter();
System.out.println(f.formatCellValue(cell));

Expand Down
Loading