Skip to content

版本1.4.18模板导出图片方式还不支持么?现在导出还是字符串 #168

@hwglhj

Description

@hwglhj

private void setValueForCellByMap(Cell cell, Map<String, Object> map) throws Exception {
CellType cellType = cell.getCellTypeEnum();
if (cellType == CellType.STRING || cellType == CellType.NUMERIC) {
cell.setCellType(CellType.STRING);
String oldString = cell.getStringCellValue();
if (oldString != null && oldString.indexOf("{{") != -1 && !oldString.contains("fe:")) {
String params = null;
boolean isNumber = false;
if (this.isNumber(oldString)) {
isNumber = true;
oldString = oldString.replace("n:", "");
}

            while(oldString.indexOf("{{") != -1) {
                params = oldString.substring(oldString.indexOf("{{") + 2, oldString.indexOf("}}"));
                oldString = oldString.replace("{{" + params + "}}", PoiElUtil.eval(params, map).toString());
            }

            if (isNumber && StringUtils.isNotBlank(oldString)) {
                cell.setCellValue(Double.parseDouble(oldString));
                cell.setCellType(CellType.NUMERIC);
            } else {
                cell.setCellValue(oldString);
            }
        }

        if (oldString != null && oldString.contains("fe:")) {
            this.addListDataToExcel(cell, map, oldString.trim());
        }

    }
}这里看着还是只有处理字符串的

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions