|
|
@ -33,7 +33,6 @@ import com.alibaba.excel.util.SheetUtils; |
|
|
|
import com.alibaba.excel.util.StringUtils; |
|
|
|
import com.alibaba.excel.util.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
|
|
|
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException; |
|
|
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException; |
|
|
|
import org.apache.poi.openxml4j.opc.OPCPackage; |
|
|
|
import org.apache.poi.openxml4j.opc.OPCPackage; |
|
|
|
import org.apache.poi.openxml4j.opc.PackageAccess; |
|
|
|
import org.apache.poi.openxml4j.opc.PackageAccess; |
|
|
@ -43,10 +42,9 @@ import org.apache.poi.openxml4j.opc.PackageRelationshipCollection; |
|
|
|
import org.apache.poi.openxml4j.opc.PackagingURIHelper; |
|
|
|
import org.apache.poi.openxml4j.opc.PackagingURIHelper; |
|
|
|
import org.apache.poi.ss.util.CellAddress; |
|
|
|
import org.apache.poi.ss.util.CellAddress; |
|
|
|
import org.apache.poi.xssf.eventusermodel.XSSFReader; |
|
|
|
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.CommentsTable; |
|
|
|
import org.apache.poi.xssf.model.SharedStringsTable; |
|
|
|
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFComment; |
|
|
|
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.CTWorkbook; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbookPr; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbookPr; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.WorkbookDocument; |
|
|
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.WorkbookDocument; |
|
|
@ -123,9 +121,9 @@ public class XlsxSaxAnalyser implements ExcelReadExecutor { |
|
|
|
sheetList.add(new ReadSheet(index, ite.getSheetName())); |
|
|
|
sheetList.add(new ReadSheet(index, ite.getSheetName())); |
|
|
|
sheetMap.put(index, inputStream); |
|
|
|
sheetMap.put(index, inputStream); |
|
|
|
if (xlsxReadContext.readWorkbookHolder().getExtraReadSet().contains(CellExtraTypeEnum.COMMENT)) { |
|
|
|
if (xlsxReadContext.readWorkbookHolder().getExtraReadSet().contains(CellExtraTypeEnum.COMMENT)) { |
|
|
|
CommentsTable commentsTable = ite.getSheetComments(); |
|
|
|
Comments comments = ite.getSheetComments(); |
|
|
|
if (null != commentsTable) { |
|
|
|
if (comments instanceof CommentsTable) { |
|
|
|
commentsTableMap.put(index, commentsTable); |
|
|
|
commentsTableMap.put(index, (CommentsTable) comments); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (xlsxReadContext.readWorkbookHolder().getExtraReadSet().contains(CellExtraTypeEnum.HYPERLINK)) { |
|
|
|
if (xlsxReadContext.readWorkbookHolder().getExtraReadSet().contains(CellExtraTypeEnum.HYPERLINK)) { |
|
|
@ -181,7 +179,7 @@ public class XlsxSaxAnalyser implements ExcelReadExecutor { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void analysisSharedStringsTable(InputStream sharedStringsTableInputStream, |
|
|
|
private void analysisSharedStringsTable(InputStream sharedStringsTableInputStream, |
|
|
|
XlsxReadWorkbookHolder xlsxReadWorkbookHolder) throws Exception { |
|
|
|
XlsxReadWorkbookHolder xlsxReadWorkbookHolder) { |
|
|
|
ContentHandler handler = new SharedStringsTableHandler(xlsxReadWorkbookHolder.getReadCache()); |
|
|
|
ContentHandler handler = new SharedStringsTableHandler(xlsxReadWorkbookHolder.getReadCache()); |
|
|
|
parseXmlSource(sharedStringsTableInputStream, handler); |
|
|
|
parseXmlSource(sharedStringsTableInputStream, handler); |
|
|
|
xlsxReadWorkbookHolder.getReadCache().putFinished(); |
|
|
|
xlsxReadWorkbookHolder.getReadCache().putFinished(); |
|
|
@ -201,7 +199,7 @@ public class XlsxSaxAnalyser implements ExcelReadExecutor { |
|
|
|
} |
|
|
|
} |
|
|
|
File readTempFile = FileUtils.createCacheTmpFile(); |
|
|
|
File readTempFile = FileUtils.createCacheTmpFile(); |
|
|
|
xlsxReadWorkbookHolder.setTempFile(readTempFile); |
|
|
|
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) { |
|
|
|
if (decryptedStream != null) { |
|
|
|
FileUtils.writeToFile(tempFile, decryptedStream, false); |
|
|
|
FileUtils.writeToFile(tempFile, decryptedStream, false); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|