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

相关推荐
逻辑驱动的ken几秒前
Java高频面试考点场景题22
java·开发语言·jvm·面试·职场和发展·求职招聘·春招
星光开发者3 分钟前
基于springboot电动汽车租赁管理系统-计算机毕设 附源码 11217
javascript·spring boot·mysql·django·php·html5·express
苍煜5 分钟前
SpringBoot Spring事务完整版详解:@Transactional注解实操 + 七大事务传播机制用法
spring boot·spring·oracle
小则又沐风a6 分钟前
list模拟实现
java·服务器·list
上弦月-编程9 分钟前
C语言链表详解,新手也能看懂! ——从入门到精通的完整教程
java·c语言·c++
专注VB编程开发20年16 分钟前
Excel 2024 / 365 已经把 “单元格填充效果→图片” 这个按钮删掉了
excel
ffqws_22 分钟前
Spring Boot 配置读取全解析:从 application.yml 到 Java 对象的完整链路
java·数据库·spring boot
clear sky .23 分钟前
【TCP】TCP数据粘包/分包问题
java·服务器·网络
云烟成雨TD24 分钟前
Spring AI 1.x 系列【29】Embedding Model(嵌入模型)
java·人工智能·spring
RuoyiOffice25 分钟前
SpringBoot+Vue3 实现 OA 公文外来文与归档台账:外部收文、BPM办理、三类公文统一归档
spring boot·微服务·uni-app·vue·ruoyi·anti-design-vue·ruoyioffice