diff --git a/laws-modules/src/main/java/com/jero/modules/laws/customcompare/service/impl/LawsCustomCompareInfoServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/laws/customcompare/service/impl/LawsCustomCompareInfoServiceImpl.java index 421b1e35..326dff9c 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/customcompare/service/impl/LawsCustomCompareInfoServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/laws/customcompare/service/impl/LawsCustomCompareInfoServiceImpl.java @@ -37,10 +37,10 @@ import com.jero.modules.system.entity.SysDictItem; import com.jero.modules.system.service.ISysDictItemService; import com.jero.modules.system.service.ISysDictService; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.util.CellRangeAddress; -import org.apache.poi.xssf.usermodel.XSSFSheet; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.shiro.SecurityUtils; import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Value; @@ -78,6 +78,7 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl list = tableDetailVO.getList(); - try (Workbook workbook = new XSSFWorkbook()){ - String fileName = "清单详情.xlsx"; + +// Workbook workbook = new XSSFWorkbook() + try (Workbook workbook = new HSSFWorkbook()){ + String fileName = "清单详情.xls"; // sheet页 - XSSFSheet sheet = (XSSFSheet) workbook.createSheet("清单详情"); + HSSFSheet sheet = (HSSFSheet) workbook.createSheet("清单详情"); // 列宽 sheet.setDefaultColumnWidth(20); @@ -386,7 +389,7 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl standardVOS, List featureList, List compareList, List list, CellStyle cellStyle) { + private void createTableCellContent(HSSFSheet sheet, List standardVOS, List featureList, List compareList, List list, CellStyle cellStyle) { for (int i = 2; i <= compareList.size() + 2; i++) { // 创建行 Row indexRow = sheet.createRow(i); @@ -506,7 +509,7 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl standardVOS, List featureList, Row indexRow, Cell indexCell, CellStyle cellStyle, XSSFSheet sheet) { + private static void createFeatureColumn(List standardVOS, List featureList, Row indexRow, Cell indexCell, CellStyle cellStyle, HSSFSheet sheet) { indexCell.setCellValue("特点/对比项"); // 计算列数量 int index = 0; @@ -582,7 +585,7 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl standardVOS, List featureList, CellStyle cellStyle) { + private void createTableSecondRow(HSSFSheet sheet, List standardVOS, List featureList, CellStyle cellStyle) { // 创建第二行 Row row = sheet.createRow(1); // 创建列 @@ -613,7 +616,7 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl> countryMap, List featureList, CellStyle cellStyle) { + private void createTableHeader(HSSFSheet sheet, Map> countryMap, List featureList, CellStyle cellStyle) { // 创建第一行 Row headerRow = sheet.createRow(0); // 创建列