Browse Source

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

4.1.3.A
jueyue 9 years ago
parent
commit
40411025dc
2 changed files with 5 additions and 8 deletions
  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 View File

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


+ 3
- 4
easypoi-base/src/main/java/org/jeecgframework/poi/util/PoiMergeCellUtil.java View File

@@ -185,11 +185,10 @@ public final class PoiMergeCellUtil {
* @return * @return
*/ */
private static String getCellNotNullText(Cell cell, int index, int rowNum) { 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…
Cancel
Save