forked from fanruan/easyexcel
Jiaju Zhuang
5 years ago
3 changed files with 61 additions and 1 deletions
@ -0,0 +1,56 @@ |
|||||||
|
package com.alibaba.excel.write.merge; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
import org.apache.poi.ss.usermodel.Cell; |
||||||
|
import org.apache.poi.ss.usermodel.Row; |
||||||
|
import org.apache.poi.ss.usermodel.Sheet; |
||||||
|
|
||||||
|
import com.alibaba.excel.metadata.CellData; |
||||||
|
import com.alibaba.excel.metadata.Head; |
||||||
|
import com.alibaba.excel.write.handler.CellWriteHandler; |
||||||
|
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder; |
||||||
|
import com.alibaba.excel.write.metadata.holder.WriteTableHolder; |
||||||
|
|
||||||
|
/** |
||||||
|
* Merge strategy |
||||||
|
* |
||||||
|
* @author Jiaju Zhuang |
||||||
|
*/ |
||||||
|
public abstract class AbstractMergeStrategy implements CellWriteHandler { |
||||||
|
@Override |
||||||
|
public void beforeCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row, |
||||||
|
Head head, Integer columnIndex, Integer relativeRowIndex, Boolean isHead) { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void afterCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Cell cell, |
||||||
|
Head head, Integer relativeRowIndex, Boolean isHead) {} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void afterCellDataConverted(WriteSheetHolder writeSheetHolder, |
||||||
|
WriteTableHolder writeTableHolder, CellData cellData, Cell cell, Head head, Integer relativeRowIndex, |
||||||
|
Boolean isHead) { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void afterCellDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, |
||||||
|
List<CellData> cellDataList, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) { |
||||||
|
if (isHead) { |
||||||
|
return; |
||||||
|
} |
||||||
|
merge(writeSheetHolder.getSheet(), cell, head, relativeRowIndex); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* merge |
||||||
|
* |
||||||
|
* @param sheet |
||||||
|
* @param cell |
||||||
|
* @param head |
||||||
|
* @param relativeRowIndex |
||||||
|
*/ |
||||||
|
protected abstract void merge(Sheet sheet, Cell cell, Head head, Integer relativeRowIndex); |
||||||
|
} |
Loading…
Reference in new issue