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博客

相关推荐
敖正炀3 分钟前
ReentrantReadWriteLock、ReentrantLock、synchronized 对比
java
cike_y14 分钟前
Java反序列化漏洞-Shiro721流程分析
java·反序列化·shiro框架
极创信息36 分钟前
信创系统认证服务怎么做?从适配到验收全流程指南
java·大数据·运维·tomcat·健康医疗
格鸰爱童话42 分钟前
向AI学习项目技能(六)
java·人工智能·spring boot·python·学习
H_老邪1 小时前
spring boot 学习之路-1.0
spring boot·后端·学习
白宇横流学长1 小时前
停车场管理系统的设计与实现
java
Flittly1 小时前
【SpringAIAlibaba新手村系列】(18)Agent 智能体与今日菜单应用
java·spring boot·agent
木井巳1 小时前
【递归算法】目标和
java·算法·leetcode·决策树·深度优先
亦暖筑序1 小时前
手写 Spring AI Agent:让大模型自主规划任务,ReAct 模式全流程拆解
java·人工智能·spring
敖正炀1 小时前
ReentrantLock 与 synchronized对比
java