private void renameSheet(String projectName,SXSSFWorkbook wb,String projectId,String month,String productId) {
Sheet sheet1=wb.createSheet(projectName+"-权限变更记录-文档库");
//写入数据
assemleExcelauthration( wb, sheet1, projectId, month);
Sheet sheet2=wb.createSheet(projectName+"-已完成基线");
assmbleFinishBaseLine( wb, sheet2, projectId, month);
Sheet sheet3=wb.createSheet(projectName+"-项目变更记录");
assmbleProjectChange( wb, sheet3, projectId, month);
Sheet sheet4=wb.createSheet(projectName+"-生产环境变更数据");
assmbleProductionEnveriment(wb, sheet4, projectId, month,productId);
}
在我根据同一个项目名新建不同的sheet时,因为sheet名称是有长度限制的,但是不会给你提示,会自动切割,这就导致我在新建同项目名的另一个sheet发生重名,我的做法有点粗暴,超过20自动切割再重新组装
private void renameSheet(String projectName,SXSSFWorkbook wb,String projectId,String month,String productId) {
if(projectName.length()>21) {
projectName=projectName.substring(0, 20);
}
Sheet sheet1=wb.createSheet(projectName+"-权限变更记录-文档库");
//写入数据
assemleExcelauthration( wb, sheet1, projectId, month);
Sheet sheet2=wb.createSheet(projectName+"-已完成基线");
assmbleFinishBaseLine( wb, sheet2, projectId, month);
Sheet sheet3=wb.createSheet(projectName+"-项目变更记录");
assmbleProjectChange( wb, sheet3, projectId, month);
Sheet sheet4=wb.createSheet(projectName+"-生产环境变更数据");
assmbleProductionEnveriment(wb, sheet4, projectId, month,productId);
}