Commit 41cb7e4e authored by yanzg's avatar yanzg

EXCEL自定义列处理

parent 5ad593aa
...@@ -3,6 +3,7 @@ package com.yanzuoguang.excel; ...@@ -3,6 +3,7 @@ package com.yanzuoguang.excel;
import com.yanzuoguang.db.impl.DbRow; import com.yanzuoguang.db.impl.DbRow;
import com.yanzuoguang.util.YzgError; import com.yanzuoguang.util.YzgError;
import com.yanzuoguang.util.base.ObjectHelper; import com.yanzuoguang.util.base.ObjectHelper;
import com.yanzuoguang.util.exception.CodeException;
import com.yanzuoguang.util.helper.CheckerHelper; import com.yanzuoguang.util.helper.CheckerHelper;
import com.yanzuoguang.util.helper.FileHelper; import com.yanzuoguang.util.helper.FileHelper;
import com.yanzuoguang.util.helper.StringHelper; import com.yanzuoguang.util.helper.StringHelper;
...@@ -289,9 +290,7 @@ public class ExcelConsole<T extends Object> implements DbRow<T> { ...@@ -289,9 +290,7 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
for (ExcelDefineCell cell : row.getCells()) { for (ExcelDefineCell cell : row.getCells()) {
cell.cellStyle = createCellStyle(cell); cell.cellStyle = createCellStyle(cell);
Object value = cell.getValue(); Object value = cell.getValue();
if (value != null) {
cell.cell = createCell(sheetRow, cell.getColumn(), StringHelper.isNumber(value), StringHelper.toString(value), cell.cellStyle); cell.cell = createCell(sheetRow, cell.getColumn(), StringHelper.isNumber(value), StringHelper.toString(value), cell.cellStyle);
}
// 合并单元格 // 合并单元格
if (cell.getWidthSize() > 1 || cell.getHeightSize() > 1) { if (cell.getWidthSize() > 1 || cell.getHeightSize() > 1) {
int rowStart = rowIndex; int rowStart = rowIndex;
...@@ -333,7 +332,13 @@ public class ExcelConsole<T extends Object> implements DbRow<T> { ...@@ -333,7 +332,13 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
String value = StringHelper.getFirst(ObjectHelper.getString(map, field)); String value = StringHelper.getFirst(ObjectHelper.getString(map, field));
sb.append(value); sb.append(value);
}); });
if (StringHelper.isDouble(formula)) {
return;
}
// 设置公式 // 设置公式
if (cell.cell == null) {
throw new CodeException("单元格没有找到,无法设置公式" + formula);
}
cell.cell.setCellFormula(formula); cell.cell.setCellFormula(formula);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment