package cn.superdesk.uniorder.common.excel.strategy.style;

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 org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Sheet;

import java.util.List;

/**
 * @Description: 设置列宽 - 无差别
 * @Author: linjinyu
 * @CreateDate: 2022/7/1 3:18 下午
 * @UpdateUser: linjinyu
 * @UpdateDate: 2022/7/1 3:18 下午
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public class EasyExcelCustomCellWriteHandler extends AbstractColumnWidthStyleStrategy {

    @Override
    protected void setColumnWidth(WriteSheetHolder writeSheetHolder, List<CellData> list, Cell cell, Head head, Integer integer, Boolean aBoolean) {

        // 简单设置
        Sheet sheet = writeSheetHolder.getSheet();
        sheet.setColumnWidth(cell.getColumnIndex(), 3300);
    }
}
