Browse Source

JSY-9752 fix : 03版本excel在跳过的时候需要读取eof和bof

pull/3/head
Echen 3 years ago
parent
commit
501742b69e
  1. 12
      pom.xml
  2. 5
      src/main/java/com/alibaba/excel/analysis/v03/handlers/BofRecordHandler.java
  3. 5
      src/main/java/com/alibaba/excel/analysis/v03/handlers/BoundSheetRecordHandler.java
  4. 5
      src/main/java/com/alibaba/excel/analysis/v03/handlers/EofRecordHandler.java
  5. 6
      src/main/java/com/alibaba/excel/analysis/v03/handlers/SstRecordHandler.java

12
pom.xml

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId> <artifactId>easyexcel</artifactId>
<version>2.2.10</version> <version>2.2.11-QFX-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>easyexcel</name> <name>easyexcel</name>
@ -127,12 +127,14 @@
</dependencies> </dependencies>
<distributionManagement> <distributionManagement>
<snapshotRepository> <snapshotRepository>
<id>ossrh</id> <id>nexus</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url> <name>maven-snapshot</name>
<url>http://mvn.finedevelop.com/repository/fanruan/</url>
</snapshotRepository> </snapshotRepository>
<repository> <repository>
<id>ossrh</id> <id>nexus</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url> <name>maven-releases</name>
<url>http://mvn.finedevelop.com/repository/fanruan-release/</url>
</repository> </repository>
</distributionManagement> </distributionManagement>

5
src/main/java/com/alibaba/excel/analysis/v03/handlers/BofRecordHandler.java

@ -20,6 +20,11 @@ import com.alibaba.excel.util.SheetUtils;
*/ */
public class BofRecordHandler extends AbstractXlsRecordHandler { public class BofRecordHandler extends AbstractXlsRecordHandler {
@Override
public boolean support(XlsReadContext xlsReadContext, Record record) {
return true;
}
@Override @Override
public void processRecord(XlsReadContext xlsReadContext, Record record) { public void processRecord(XlsReadContext xlsReadContext, Record record) {
BOFRecord br = (BOFRecord) record; BOFRecord br = (BOFRecord) record;

5
src/main/java/com/alibaba/excel/analysis/v03/handlers/BoundSheetRecordHandler.java

@ -13,6 +13,11 @@ import com.alibaba.excel.context.xls.XlsReadContext;
*/ */
public class BoundSheetRecordHandler extends AbstractXlsRecordHandler implements IgnorableXlsRecordHandler { public class BoundSheetRecordHandler extends AbstractXlsRecordHandler implements IgnorableXlsRecordHandler {
@Override
public boolean support(XlsReadContext xlsReadContext, Record record) {
return true;
}
@Override @Override
public void processRecord(XlsReadContext xlsReadContext, Record record) { public void processRecord(XlsReadContext xlsReadContext, Record record) {
BoundSheetRecord bsr = (BoundSheetRecord)record; BoundSheetRecord bsr = (BoundSheetRecord)record;

5
src/main/java/com/alibaba/excel/analysis/v03/handlers/EofRecordHandler.java

@ -19,6 +19,11 @@ import com.alibaba.excel.read.metadata.holder.xls.XlsReadSheetHolder;
*/ */
public class EofRecordHandler extends AbstractXlsRecordHandler implements IgnorableXlsRecordHandler { public class EofRecordHandler extends AbstractXlsRecordHandler implements IgnorableXlsRecordHandler {
@Override
public boolean support(XlsReadContext xlsReadContext, Record record) {
return true;
}
@Override @Override
public void processRecord(XlsReadContext xlsReadContext, Record record) { public void processRecord(XlsReadContext xlsReadContext, Record record) {
if (xlsReadContext.readSheetHolder() == null) { if (xlsReadContext.readSheetHolder() == null) {

6
src/main/java/com/alibaba/excel/analysis/v03/handlers/SstRecordHandler.java

@ -13,6 +13,12 @@ import com.alibaba.excel.context.xls.XlsReadContext;
* @author Dan Zheng * @author Dan Zheng
*/ */
public class SstRecordHandler extends AbstractXlsRecordHandler implements IgnorableXlsRecordHandler { public class SstRecordHandler extends AbstractXlsRecordHandler implements IgnorableXlsRecordHandler {
@Override
public boolean support(XlsReadContext xlsReadContext, Record record) {
return true;
}
@Override @Override
public void processRecord(XlsReadContext xlsReadContext, Record record) { public void processRecord(XlsReadContext xlsReadContext, Record record) {
xlsReadContext.readWorkbookHolder().setReadCache(new XlsCache((SSTRecord)record)); xlsReadContext.readWorkbookHolder().setReadCache(new XlsCache((SSTRecord)record));

Loading…
Cancel
Save