修改标准解读流程导出问题

This commit is contained in:
梁琦涛
2024-09-06 14:11:18 +08:00
parent 6ab79fca61
commit 13adac0b56
2 changed files with 24 additions and 18 deletions
@@ -0,0 +1,24 @@
package com.jero.config;
import org.apache.poi.ss.SpreadsheetVersion;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import java.lang.reflect.Field;
/**
* 解决导出excel单元格长度过长问题
* @version 1.0
* @date 2024/9/5 15:16
*/
@Component
public class ApplicationCommandLine implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {
SpreadsheetVersion spreadsheetVersion = SpreadsheetVersion.EXCEL2007;
Field maxTextLength = spreadsheetVersion.getClass().getDeclaredField("_maxTextLength");
maxTextLength.setAccessible(true);
maxTextLength.set(spreadsheetVersion, Integer.MAX_VALUE);
}
}