Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

用模版导出xlsx时如果存在循环行导出会导致循环行后面的公式失效 #7161

Closed
q060831 opened this issue Sep 3, 2024 · 2 comments

Comments

@q060831
Copy link

q060831 commented Sep 3, 2024

版本号:3.7.0

问题描述:用模版导出xlsx时如果存在循环行导出会导致循环行后面的公式失效
例如:第5行是循环行,第6行使用公式对前面行进行汇总,导出后汇总的公式没了
看了一下源码是PoiExcelTempUtil工具类的问题

               // 重设了单元格格式
                cell.setCellStyle((CellStyle) map.get("cellStyle"));
                if ((boolean) map.get("isDate")) {
                    cell.setCellValue((Date) map.get("value"));
                } else {
                    CellType cellType = (CellType) map.get("cellType");
                    switch (cellType) {
                        case NUMERIC:
                            cell.setCellValue((double) map.get("value"));
                            break;
                        case STRING:
                            cell.setCellValue((String) map.get("value"));
                            break; 
                        case FORMULA:
                           // 这里没有把公式放回去
                          // 要加上这个
                           cell.setCellFormula((String) map.get("value"));
                            break;
                        case BLANK:
                            break;
                        case BOOLEAN:
                            cell.setCellValue((boolean) map.get("value"));
                        case ERROR:
                            break;
                    }
                }

错误截图:
模版:
1
导出后
2
代码bug的地方
3

@zhangdaiscott
Copy link
Member

sq

@lsqGitHub716
Copy link

已修改,下版本发布

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants