提供可以自定义excel行创建器的接口。
/**
* @version 5.1.3
* Created by sunmondong on 2021/4/9
*/
@Open
public interface ExcelRowCreatorProvider extends Immutable {
String XML_TAG = "ExcelRowCreatorProvider";
int CURRENT_LEVEL = 1;
/**
* 获取Excel行生成器
*/
WorkbookRowCreator getRowCreator(Workbook workbook, String sheetName, ExportContext context);
}
|
package com.finebi.dashboard.api.service.export.provider;
import com.finebi.dashboard.api.service.export.TableRangeAddress;
import com.finebi.dashboard.api.service.export.TableRow;
import com.fr.common.annotations.Open;
import org.jetbrains.annotations.Nullable;
/**
* 绘图以及绘制excel是不同的创建器
* 抽象成为分页,逻辑行号以及不同渲染接口对接的接口
*
* @author andrew_asa
* @date 2018/8/25.
*/
@Open
public interface WorkbookRowCreator {
/**
* 生成列
*/
TableRow createRow(int rowNum);
/**
* 添加合并单元格
*/
void addMergedRegion(TableRangeAddress region);
/**
* 获取列
*/
@Nullable
TableRow getRow(int rowNum);
}
|
|
/**
* @version 5.1.3
* Created by sunmondong on 2021/4/9
*/
@API(level = ExcelRowCreatorProvider.CURRENT_LEVEL)
public abstract class AbstractExcelRowCreatorProvider implements ExcelRowCreatorProvider {
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public int layerIndex() {
return 0;
}
}
|
public abstract class AbstractExcelRowCreator implements WorkbookRowCreator {
}
|