33
33
import com .alibaba .excel .util .StringUtils ;
34
34
35
35
import lombok .extern .slf4j .Slf4j ;
36
- import org .apache .commons .collections4 .CollectionUtils ;
37
36
import org .apache .poi .openxml4j .exceptions .InvalidFormatException ;
38
37
import org .apache .poi .openxml4j .opc .OPCPackage ;
39
38
import org .apache .poi .openxml4j .opc .PackageAccess ;
43
42
import org .apache .poi .openxml4j .opc .PackagingURIHelper ;
44
43
import org .apache .poi .ss .util .CellAddress ;
45
44
import org .apache .poi .xssf .eventusermodel .XSSFReader ;
45
+ import org .apache .poi .xssf .model .Comments ;
46
46
import org .apache .poi .xssf .model .CommentsTable ;
47
- import org .apache .poi .xssf .model .SharedStringsTable ;
48
47
import org .apache .poi .xssf .usermodel .XSSFComment ;
49
- import org .apache .poi .xssf .usermodel .XSSFRelation ;
50
48
import org .openxmlformats .schemas .spreadsheetml .x2006 .main .CTWorkbook ;
51
49
import org .openxmlformats .schemas .spreadsheetml .x2006 .main .CTWorkbookPr ;
52
50
import org .openxmlformats .schemas .spreadsheetml .x2006 .main .WorkbookDocument ;
@@ -123,9 +121,9 @@ public XlsxSaxAnalyser(XlsxReadContext xlsxReadContext, InputStream decryptedStr
123
121
sheetList .add (new ReadSheet (index , ite .getSheetName ()));
124
122
sheetMap .put (index , inputStream );
125
123
if (xlsxReadContext .readWorkbookHolder ().getExtraReadSet ().contains (CellExtraTypeEnum .COMMENT )) {
126
- CommentsTable commentsTable = ite .getSheetComments ();
127
- if (null != commentsTable ) {
128
- commentsTableMap .put (index , commentsTable );
124
+ Comments comments = ite .getSheetComments ();
125
+ if (comments instanceof CommentsTable ) {
126
+ commentsTableMap .put (index , ( CommentsTable ) comments );
129
127
}
130
128
}
131
129
if (xlsxReadContext .readWorkbookHolder ().getExtraReadSet ().contains (CellExtraTypeEnum .HYPERLINK )) {
@@ -181,7 +179,7 @@ private void analysisUse1904WindowDate(XSSFReader xssfReader, XlsxReadWorkbookHo
181
179
}
182
180
183
181
private void analysisSharedStringsTable (InputStream sharedStringsTableInputStream ,
184
- XlsxReadWorkbookHolder xlsxReadWorkbookHolder ) throws Exception {
182
+ XlsxReadWorkbookHolder xlsxReadWorkbookHolder ) {
185
183
ContentHandler handler = new SharedStringsTableHandler (xlsxReadWorkbookHolder .getReadCache ());
186
184
parseXmlSource (sharedStringsTableInputStream , handler );
187
185
xlsxReadWorkbookHolder .getReadCache ().putFinished ();
@@ -201,7 +199,7 @@ private OPCPackage readOpcPackage(XlsxReadWorkbookHolder xlsxReadWorkbookHolder,
201
199
}
202
200
File readTempFile = FileUtils .createCacheTmpFile ();
203
201
xlsxReadWorkbookHolder .setTempFile (readTempFile );
204
- File tempFile = new File (readTempFile .getPath (), UUID .randomUUID (). toString () + ".xlsx" );
202
+ File tempFile = new File (readTempFile .getPath (), UUID .randomUUID () + ".xlsx" );
205
203
if (decryptedStream != null ) {
206
204
FileUtils .writeToFile (tempFile , decryptedStream , false );
207
205
} else {
0 commit comments