瀏覽代碼

合并单元格,获取cell改为递归,之前判断有问题

4.1.3.A
jueyue 9 年之前
父節點
當前提交
40411025dc
共有 2 個文件被更改,包括 5 次插入8 次删除
  1. +2
    -4
      easypoi-base/src/main/java/org/jeecgframework/poi/util/PoiElUtil.java
  2. +3
    -4
      easypoi-base/src/main/java/org/jeecgframework/poi/util/PoiMergeCellUtil.java

+ 2
- 4
easypoi-base/src/main/java/org/jeecgframework/poi/util/PoiElUtil.java 查看文件

@@ -25,6 +25,8 @@ import org.jeecgframework.poi.exception.excel.ExcelExportException;
* @date 2015年4月25日 下午12:13:21
*/
public final class PoiElUtil {
public static final String LENGTH = "le:";
public static final String FOREACH = "fe:";
@@ -220,10 +222,6 @@ public final class PoiElUtil {
.trim();
}
public static void main(String[] args) {
System.out.println(getKey(IF_DELETE, "测试 " + IF_DELETE + " (小明)"));
}
/**
* 三目运算
* @return


+ 3
- 4
easypoi-base/src/main/java/org/jeecgframework/poi/util/PoiMergeCellUtil.java 查看文件

@@ -185,11 +185,10 @@ public final class PoiMergeCellUtil {
* @return
*/
private static String getCellNotNullText(Cell cell, int index, int rowNum) {
String temp = cell.getRow().getCell(index).getStringCellValue();
while (StringUtils.isEmpty(temp)) {
temp = cell.getRow().getSheet().getRow(--rowNum).getCell(index).getStringCellValue();
if(cell.getRow().getCell(index) != null && StringUtils.isNotEmpty(cell.getRow().getCell(index).getStringCellValue())){
return cell.getRow().getCell(index).getStringCellValue();
}
return temp;
return getCellNotNullText(cell.getRow().getSheet().getRow(--rowNum).getCell(index),index,rowNum);
}
}

Loading…
取消
儲存