ludc
2024-09-14 36c2449aec5b51e5ed4e5c6841154b746060e09a
Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/util/ExcelUtil.java
@@ -1,5 +1,6 @@
package com.vci.starter.poi.util;
import cn.hutool.core.collection.CollUtil;
import com.vci.starter.poi.annotation.ExcelColumn;
import com.vci.starter.poi.annotation.ExcelTitle;
import com.vci.starter.poi.bo.*;
@@ -630,6 +631,8 @@
               //写值
               setCellValue(cell, value);
            }
            //设置自适应列宽
            sheet.autoSizeColumn(ed.getCol());
            if(ed.getWidth()!=null && ed.getWidth()>0){
               sheet.setColumnWidth(cell.getColumnIndex(),(int)(ed.getWidth() + 0.72)*256);
            }
@@ -855,6 +858,7 @@
            if (ed.getColTo() < ed.getCol()) {
               ed.setColTo(ed.getCol());
            }
            List<CellRangeAddress> cellRangeAddressList = sheet.getMergedRegions();
            sheet.addMergedRegion(new CellRangeAddress(ed.getRow(), ed.getRowTo(), ed.getCol(), ed.getColTo()));
         });
      }
@@ -867,7 +871,7 @@
    * @return 数据列表
    * @throws VciBaseException 执行出错的时候会抛出异常
    */
   public static  List<SheetDataSet> readDataObjectFromExcel(File file) throws VciBaseException {
   public static List<SheetDataSet> readDataObjectFromExcel(File file) throws VciBaseException {
      return readDataObjectFromExcel(file, SheetDataSet.class);
   }
@@ -993,6 +997,7 @@
      try {
         for (int sheetIndex = 0; sheetIndex < workbook.getNumberOfSheets(); sheetIndex++) {
            Sheet sheet = workbook.getSheetAt(sheetIndex);
            String sheetName=sheet.getSheetName();
            if(StringUtils.isNotBlank(excelOption.getSheetName())){
               if(!sheet.getSheetName().equalsIgnoreCase(excelOption.getSheetName())){
                  continue;