yangys
2024-11-02 f69073b835f1a0c66590130e1830edcdd75ebb8a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package com.qianwen.smartman.modules.mdc.strategy;
 
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.Head;
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
import com.alibaba.excel.write.style.column.AbstractColumnWidthStyleStrategy;
import java.util.List;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Sheet;
 
public class ExcelWidthStyleStrategy extends AbstractColumnWidthStyleStrategy {
    protected void setColumnWidth(WriteSheetHolder writeSheetHolder, List<CellData> cellDataList, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) {
        Sheet sheet = writeSheetHolder.getSheet();
        sheet.setColumnWidth(cell.getColumnIndex(), 5000);
    }
}