springboot 下载文件为excel数据,中文自定义单元格宽度

java 复制代码
/**
 2      * @Description:表格自适应宽度(中文支持)
 3      * @Author: 
 4      * @param sheet sheet
 5      * @param columnLength 列数
 6      */
 7     private static void setSizeColumn(HSSFSheet sheet, int columnLength) {
 8         for (int columnNum = 0; columnNum <= columnLength; columnNum++) {
 9             int columnWidth = sheet.getColumnWidth(columnNum) / 256;
10             for (int rowNum = 0; rowNum < sheet.getLastRowNum(); rowNum++) {
11                 HSSFRow currentRow; // 当前行未被使用过
12                 if (sheet.getRow(rowNum) == null) {
13                     currentRow = sheet.createRow(rowNum);
14                 } else {
15                     currentRow = sheet.getRow(rowNum);
16                 }
17                 if (currentRow.getCell(columnNum) != null) {
18                     HSSFCell currentCell = currentRow.getCell(columnNum);
19                     if (currentCell.getCellType() == HSSFCell.CELL_TYPE_STRING) {
20                         int length = currentCell.getStringCellValue().getBytes().length;
21                         if (columnWidth < length) {
22                             columnWidth = length;
23                         }
24                     }
25                 }
26             }
27             sheet.setColumnWidth(columnNum, columnWidth * 256);
28         }
29     }

Flowable工作流6.3.0 项目实战_flowable项目实战_马艳鹏学java的博客-CSDN博客

RuoYi-flowable: 🌟 基于RuoYi-vue + flowable 6.7.2 的工作流管理 右上角点个 star、fork 🌟 持续关注更新哟 农业认养商城系统:https://gitee.com/tony2y/smart-breed智慧景区管理系统 :https://gitee.com/tony2y/scenic-spot

springboot集成flowable简单实例入门_flowable接口文档_cherry有点甜·的博客-CSDN博客

相关推荐
掘金_答案38 分钟前
上线那天,一个 ConcurrentHashMap 差点送走我的 AI 客服——3 天排查 JVM 血泪史
java·后端·架构
MindUp1 小时前
企业网盘权限模型解析:多层级访问控制与审计能力选型指南
java·linux·运维
NG4771 小时前
【软件设计与体系结构】-策略设计模式
java·设计模式·软件工程
程序员天天困2 小时前
优雅记录操作日志:从注解到 SpEL 的全链路实践与开源方案对比
java·后端
战血石LoveYY2 小时前
Integer类型超限,导致数据异常
java·算法
Fuzio3 小时前
用 Spring Boot + Vue + Fuzio 构建现代 Java 桌面应用
vue.js·spring boot
乐观的Terry4 小时前
1、为什么要自己造发布系统
java·spring boot·后端·spring cloud·架构
兰令水4 小时前
hot100【acm版】【2026.7.13打卡-java版本】
java·开发语言·数据结构·算法·leetcode·面试
名字还没想好☜4 小时前
用 Redis + Redisson 实现分布式锁:从踩坑到生产可用
java·redis·分布式·junit·分布式锁·redisson