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

相关推荐
gelald5 分钟前
ReentrantLock 学习笔记
java·后端
计算机学姐13 分钟前
基于SpringBoot的校园资源共享系统【个性化推荐算法+数据可视化统计】
java·vue.js·spring boot·后端·mysql·spring·信息可视化
一条咸鱼_SaltyFish17 分钟前
[Day15] 若依框架二次开发改造记录:定制化之旅 contract-security-ruoyi
java·大数据·经验分享·分布式·微服务·架构·ai编程
跟着珅聪学java22 分钟前
JavaScript 底层原理
java·开发语言
廋到被风吹走24 分钟前
【Spring】Spring Boot 配置管理深度指南:Profile、类型安全与加密
spring boot·安全·spring
Mr. Cao code28 分钟前
Docker数据管理:持久化存储最佳实践
java·docker·容器
强子感冒了32 分钟前
Java 学习笔记:File类核心API详解与使用指南
java·笔记·学习
spencer_tseng42 分钟前
eclipse ALT+SHIFT+A
java·ide·eclipse
vyuvyucd43 分钟前
C++排序算法全解析
java·数据结构·算法
BD_Marathon1 小时前
SpringBoot程序快速启动
java·spring boot·后端