Commit e44443aba16f6b791ca2a896d6aa5d6d55fe1486

Authored by 王彬
1 parent 334261a7
Exists in master

optimized share table tag

@@ -54,7 +54,7 @@ uploadArchives { @@ -54,7 +54,7 @@ uploadArchives {
54 authentication(userName: NEXUS_USERNAME, password: NEXUS_PASSWORD) 54 authentication(userName: NEXUS_USERNAME, password: NEXUS_PASSWORD)
55 } 55 }
56 pom.project { 56 pom.project {
57 - version '2.2.20' 57 + version '2.2.22'
58 artifactId ARTIFACT_Id 58 artifactId ARTIFACT_Id
59 groupId GROUP_ID 59 groupId GROUP_ID
60 packaging TYPE 60 packaging TYPE
src/main/java/com/taover/easyexcel/analysis/v07/handlers/sax/SharedStringsTableHandler.java
@@ -12,11 +12,14 @@ import com.taover.easyexcel.cache.ReadCache; @@ -12,11 +12,14 @@ import com.taover.easyexcel.cache.ReadCache;
12 */ 12 */
13 public class SharedStringsTableHandler extends DefaultHandler { 13 public class SharedStringsTableHandler extends DefaultHandler {
14 private static final String T_TAG = "t"; 14 private static final String T_TAG = "t";
  15 + private static final String X_T_TAG = "x:t";
15 private static final String SI_TAG = "si"; 16 private static final String SI_TAG = "si";
  17 + private static final String X_SI_TAG = "x:si";
16 /** 18 /**
17 * Mac 2016 2017 will have this extra field to ignore 19 * Mac 2016 2017 will have this extra field to ignore
18 */ 20 */
19 private static final String RPH_TAG = "rPh"; 21 private static final String RPH_TAG = "rPh";
  22 + private static final String X_RPH_TAG = "x:rPh";
20 23
21 /** 24 /**
22 * The final piece of data 25 * The final piece of data
@@ -43,19 +46,19 @@ public class SharedStringsTableHandler extends DefaultHandler { @@ -43,19 +46,19 @@ public class SharedStringsTableHandler extends DefaultHandler {
43 46
44 @Override 47 @Override
45 public void startElement(String uri, String localName, String name, Attributes attributes) { 48 public void startElement(String uri, String localName, String name, Attributes attributes) {
46 - if (T_TAG.equals(name)) { 49 + if (T_TAG.equals(name) || X_T_TAG.equals(name)) {
47 currentElementData = null; 50 currentElementData = null;
48 isTagt = true; 51 isTagt = true;
49 - } else if (SI_TAG.equals(name)) { 52 + } else if (SI_TAG.equals(name) || X_SI_TAG.equals(name)) {
50 currentData = null; 53 currentData = null;
51 - } else if (RPH_TAG.equals(name)) { 54 + } else if (RPH_TAG.equals(name) || X_RPH_TAG.equals(name)) {
52 ignoreTagt = true; 55 ignoreTagt = true;
53 } 56 }
54 } 57 }
55 58
56 @Override 59 @Override
57 public void endElement(String uri, String localName, String name) { 60 public void endElement(String uri, String localName, String name) {
58 - if (T_TAG.equals(name)) { 61 + if (T_TAG.equals(name) || X_T_TAG.equals(name)) {
59 if (currentElementData != null) { 62 if (currentElementData != null) {
60 if (currentData == null) { 63 if (currentData == null) {
61 currentData = new StringBuilder(); 64 currentData = new StringBuilder();
@@ -63,13 +66,13 @@ public class SharedStringsTableHandler extends DefaultHandler { @@ -63,13 +66,13 @@ public class SharedStringsTableHandler extends DefaultHandler {
63 currentData.append(currentElementData); 66 currentData.append(currentElementData);
64 } 67 }
65 isTagt = false; 68 isTagt = false;
66 - } else if (SI_TAG.equals(name)) { 69 + } else if (SI_TAG.equals(name) || X_SI_TAG.equals(name)) {
67 if (currentData == null) { 70 if (currentData == null) {
68 readCache.put(null); 71 readCache.put(null);
69 } else { 72 } else {
70 readCache.put(currentData.toString()); 73 readCache.put(currentData.toString());
71 } 74 }
72 - } else if (RPH_TAG.equals(name)) { 75 + } else if (RPH_TAG.equals(name) || X_RPH_TAG.equals(name)) {
73 ignoreTagt = false; 76 ignoreTagt = false;
74 } 77 }
75 } 78 }
src/test/java/com/taover/easyexcel/test/WbTest.java
@@ -11,7 +11,8 @@ import com.taover.easyexcel.EasyExcel; @@ -11,7 +11,8 @@ import com.taover.easyexcel.EasyExcel;
11 public class WbTest { 11 public class WbTest {
12 public static void main(String[] args) { 12 public static void main(String[] args) {
13 //File dataFile = new File("C:\\Users\\Administrator\\Desktop\\数据为空\\好合意商城_20210127_16_47(1).xlsx"); 13 //File dataFile = new File("C:\\Users\\Administrator\\Desktop\\数据为空\\好合意商城_20210127_16_47(1).xlsx");
14 - File dataFile = new File("C:\\Users\\Administrator\\Desktop\\Excel隐藏行\\配送确认1.16(1).xlsx"); 14 + //File dataFile = new File("C:\\Users\\Administrator\\Desktop\\Excel隐藏行\\配送确认1.16(1).xlsx");
  15 + File dataFile = new File("C:\\Users\\Administrator\\Desktop\\Excel隐藏行\\吉祥三宝-20210128-29条(1).xlsx");
15 //File dataFile = new File("C:\\Users\\Administrator\\Desktop\\表头匹配-测试文件\\多sheet-多个可用-数据有无.xlsx"); 16 //File dataFile = new File("C:\\Users\\Administrator\\Desktop\\表头匹配-测试文件\\多sheet-多个可用-数据有无.xlsx");
16 // List<List<Object>> data = transListMapTo2List(EasyExcel.read(dataFile).readHiddenRow(false).headRowNumber(0).doReadSelectedSync()); 17 // List<List<Object>> data = transListMapTo2List(EasyExcel.read(dataFile).readHiddenRow(false).headRowNumber(0).doReadSelectedSync());
17 // for(List<Object> row: data) { 18 // for(List<Object> row: data) {