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

相关推荐
JMchen12313 分钟前
Android后台服务与网络保活:WorkManager的实战应用
android·java·网络·kotlin·php·android-studio
阔皮大师29 分钟前
INote轻量文本编辑器
java·javascript·python·c#
小法师爱分享33 分钟前
StickyNotes,简单便签超实用
java·python
qq_2975746733 分钟前
Linux 服务器 Java 开发环境搭建保姆级教程
java·linux·服务器
金牌归来发现妻女流落街头1 小时前
【从SpringBoot到SpringCloud】
java·spring boot·spring cloud
毅炼1 小时前
Java 基础常见问题总结(4)
java·后端
GR2342341 小时前
2025年影视仓TV+手机官方版 内置地址源支持高清直播
java·智能手机·软件
皮卡丘不断更1 小时前
手搓本地 RAG:我用 Python 和 Spring Boot 给 AI 装上了“实时代码监控”
人工智能·spring boot·python·ai编程
程序员清风1 小时前
北京回长沙了,简单谈谈感受!
java·后端·面试
lucky67071 小时前
Spring Boot集成Kafka:最佳实践与详细指南
spring boot·kafka·linq