package com.cyksj.model.excel.merge;

import com.alibaba.excel.write.handler.RowWriteHandler;
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
import com.alibaba.excel.write.metadata.holder.WriteTableHolder;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.util.CellRangeAddress;

/**
 * 项目名: yhlxj
 * 文件名: RealGoodsOrderLineStrategy
 * 创建者: JavaZou
 * 创建时间:2023/11/3 13:48
 */
public class RealGoodsOrderLineStrategy implements RowWriteHandler {

	@Override
	public void beforeRowCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Integer integer, Integer integer1, Boolean isHead) {
		//标题前 增加几行
		Sheet sheet = writeSheetHolder.getSheet();
		sheet.createRow(0);
		//合并单元格
		CellRangeAddress first_row = new CellRangeAddress(0,0,
				0, 15);
		sheet.addMergedRegionUnsafe(first_row);
		sheet.createRow(1);
		CellRangeAddress second_row = new CellRangeAddress(1,1,
				0, 15);
		sheet.addMergedRegionUnsafe(second_row);
	}

	@Override
	public void afterRowCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row, Integer relativeRowIndex, Boolean isHead) {
	}

	@Override
	public void afterRowDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row, Integer integer, Boolean isHead) {
	}
}
