Browse Source

Merge branch 'bugfix' into comment_typo_fix

developing
Jiaju Zhuang 3 years ago committed by GitHub
parent
commit
4af4ea8b19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      README.md
  2. 8
      pom.xml
  3. 11
      src/main/java/com/alibaba/excel/analysis/v07/XlsxSaxAnalyser.java
  4. 14
      src/main/java/com/alibaba/excel/analysis/v07/handlers/CellTagHandler.java
  5. 2
      src/main/java/com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java
  6. 2
      src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java
  7. 9
      src/test/java/com/alibaba/easyexcel/test/temp/WriteV33Test.java
  8. 4
      src/test/java/com/alibaba/easyexcel/test/temp/dataformat/DataFormatter1.java

3
README.md

@ -10,7 +10,8 @@ EasyExcel
[钉钉1群(已满): 21960511](https://qr.dingtalk.com/action/joingroup?code=v1,k1,cchz6k12ci9B08NNqhNRFGXocNVHrZtW0kaOtTKg/Rk=&_dt_no_comment=1&origin=11) [钉钉1群(已满): 21960511](https://qr.dingtalk.com/action/joingroup?code=v1,k1,cchz6k12ci9B08NNqhNRFGXocNVHrZtW0kaOtTKg/Rk=&_dt_no_comment=1&origin=11)
[钉钉2群(已满): 32796397](https://qr.dingtalk.com/action/joingroup?code=v1,k1,jyU9GtEuNU5S0QTyklqYcYJ8qDZtUuTPMM7uPZTS8Hs=&_dt_no_comment=1&origin=11) [钉钉2群(已满): 32796397](https://qr.dingtalk.com/action/joingroup?code=v1,k1,jyU9GtEuNU5S0QTyklqYcYJ8qDZtUuTPMM7uPZTS8Hs=&_dt_no_comment=1&origin=11)
[钉钉3群(已满): 33797247](https://qr.dingtalk.com/action/joingroup?code=v1,k1,3UGlEScTGQaHpW2cIRo+gkxJ9EVZ5fz26M6nW3uFP30=&_dt_no_comment=1&origin=11) [钉钉3群(已满): 33797247](https://qr.dingtalk.com/action/joingroup?code=v1,k1,3UGlEScTGQaHpW2cIRo+gkxJ9EVZ5fz26M6nW3uFP30=&_dt_no_comment=1&origin=11)
[钉钉4群: 33491624](https://qr.dingtalk.com/action/joingroup?code=v1,k1,V14Pb65Too70rQkEaJ9ohb6lZBZbtp6jIL/q9EWh9vA=&_dt_no_comment=1&origin=11) [钉钉4群(已满): 33491624](https://qr.dingtalk.com/action/joingroup?code=v1,k1,V14Pb65Too70rQkEaJ9ohb6lZBZbtp6jIL/q9EWh9vA=&_dt_no_comment=1&origin=11)
[钉钉5群: 32134498](https://h5.dingtalk.com/circle/healthCheckin.html?dtaction=os&corpId=dingb9fa1325d9dccc3ecac589edd02f1650&5233a=71a83&cbdbhh=qwertyuiop)
[官方网站: https://yuque.com/easyexcel](https://www.yuque.com/easyexcel/doc/easyexcel) [官方网站: https://yuque.com/easyexcel](https://www.yuque.com/easyexcel/doc/easyexcel)
[常见问题](https://www.yuque.com/easyexcel/faq) [常见问题](https://www.yuque.com/easyexcel/faq)

8
pom.xml

@ -60,17 +60,17 @@
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId> <artifactId>poi</artifactId>
<version>3.17</version> <version>5.0.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId> <artifactId>poi-ooxml</artifactId>
<version>3.17</version> <version>5.0.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId> <artifactId>poi-ooxml-full</artifactId>
<version>3.17</version> <version>5.0.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cglib</groupId> <groupId>cglib</groupId>

11
src/main/java/com/alibaba/excel/analysis/v07/XlsxSaxAnalyser.java

@ -5,6 +5,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
@ -215,10 +216,12 @@ public class XlsxSaxAnalyser implements ExcelReadExecutor {
if (commentsTable == null) { if (commentsTable == null) {
return; return;
} }
Map<CellAddress, XSSFComment> cellComments = commentsTable.getCellComments(); Iterator<CellAddress> cellAddresses = commentsTable.getCellAddresses();
for (XSSFComment xssfComment : cellComments.values()) { for (Iterator<CellAddress> it = cellAddresses; it.hasNext(); ) {
CellExtra cellExtra = new CellExtra(CellExtraTypeEnum.COMMENT, xssfComment.getString().toString(), CellAddress cellAddress = it.next();
xssfComment.getRow(), xssfComment.getColumn()); XSSFComment cellComment = commentsTable.findCellComment(cellAddress);
CellExtra cellExtra = new CellExtra(CellExtraTypeEnum.COMMENT, cellComment.getString().toString(),
cellAddress.getRow(), cellAddress.getColumn());
xlsxReadContext.readSheetHolder().setCellExtra(cellExtra); xlsxReadContext.readSheetHolder().setCellExtra(cellExtra);
xlsxReadContext.analysisEventProcessor().extra(xlsxReadContext); xlsxReadContext.analysisEventProcessor().extra(xlsxReadContext);
} }

14
src/main/java/com/alibaba/excel/analysis/v07/handlers/CellTagHandler.java

@ -27,13 +27,13 @@ public class CellTagHandler extends AbstractXlsxTagHandler {
xlsxReadSheetHolder.setColumnIndex(PositionUtils.getCol(attributes.getValue(ExcelXmlConstants.ATTRIBUTE_R), xlsxReadSheetHolder.setColumnIndex(PositionUtils.getCol(attributes.getValue(ExcelXmlConstants.ATTRIBUTE_R),
xlsxReadSheetHolder.getColumnIndex())); xlsxReadSheetHolder.getColumnIndex()));
// t="s", it means String // t="s" ,it means String
// t="str", it means String, but does not need to be read in the 'sharedStrings.xml' // t="str" ,it means String,but does not need to be read in the 'sharedStrings.xml'
// t="inlineStr", it means String // t="inlineStr" ,it means String
// t="b", it means Boolean // t="b" ,it means Boolean
// t="e", it means Error // t="e" ,it means Error
// t="n", it means Number // t="n" ,it means Number
// t is null, it means Empty or Number // t is null ,it means Empty or Number
CellDataTypeEnum type = CellDataTypeEnum.buildFromCellType(attributes.getValue(ExcelXmlConstants.ATTRIBUTE_T)); CellDataTypeEnum type = CellDataTypeEnum.buildFromCellType(attributes.getValue(ExcelXmlConstants.ATTRIBUTE_T));
xlsxReadSheetHolder.setTempCellData(new CellData(type)); xlsxReadSheetHolder.setTempCellData(new CellData(type));
xlsxReadSheetHolder.setTempData(new StringBuilder()); xlsxReadSheetHolder.setTempData(new StringBuilder());

2
src/main/java/com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java

@ -399,7 +399,7 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor {
* @return Returns the data that the cell needs to replace * @return Returns the data that the cell needs to replace
*/ */
private String prepareData(Cell cell, int rowIndex, int columnIndex, Map<String, Set<Integer>> firstRowCache) { private String prepareData(Cell cell, int rowIndex, int columnIndex, Map<String, Set<Integer>> firstRowCache) {
if (!CellType.STRING.equals(cell.getCellTypeEnum())) { if (!CellType.STRING.equals(cell.getCellType())) {
return null; return null;
} }
String value = cell.getStringCellValue(); String value = cell.getStringCellValue();

2
src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java

@ -5,9 +5,9 @@ import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import org.apache.poi.hssf.util.CellReference;
import org.apache.poi.ss.usermodel.FillPatternType; import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.IndexedColors; import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.util.CellReference;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;

9
src/test/java/com/alibaba/easyexcel/test/temp/WriteV33Test.java

@ -1,13 +1,8 @@
package com.alibaba.easyexcel.test.temp; package com.alibaba.easyexcel.test.temp;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import org.apache.poi.hssf.util.CellReference;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -19,10 +14,6 @@ import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.merge.OnceAbsoluteMergeStrategy; import com.alibaba.excel.write.merge.OnceAbsoluteMergeStrategy;
import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import com.alibaba.excel.write.metadata.style.WriteFont;
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import com.alibaba.fastjson.JSON;
/** /**
* 临时测试 * 临时测试

4
src/test/java/com/alibaba/easyexcel/test/temp/dataformat/DataFormatter1.java

@ -968,12 +968,12 @@ public class DataFormatter1 implements Observer {
return ""; return "";
} }
CellType cellType = cell.getCellTypeEnum(); CellType cellType = cell.getCellType();
if (cellType == CellType.FORMULA) { if (cellType == CellType.FORMULA) {
if (evaluator == null) { if (evaluator == null) {
return cell.getCellFormula(); return cell.getCellFormula();
} }
cellType = evaluator.evaluateFormulaCellEnum(cell); cellType = evaluator.evaluateFormulaCell(cell);
} }
switch (cellType) { switch (cellType) {
case NUMERIC: case NUMERIC:

Loading…
Cancel
Save