导出excel单sheet处理(批注处理)接口demo
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

53 lines
1.3 KiB

package com.tptj.demo.hg.comment.excel.processor;
import com.fr.report.cell.ResultCellElement;
import java.util.ArrayList;
import java.util.List;
/**
* @author 秃破天际
* @version 10.0
* Created by 秃破天际 on 2021-04-13
**/
public class ExcelDictionaryBuilder {
/**
* 统一记录一个sheet包含的所有数据字典,把相同的进行归类合并
*/
private List<ExcelDictionary> list = new ArrayList<ExcelDictionary>();
/**
* 进行归类合并操作
* @param dic
* @param cell
*/
public void add(ExcelDictionary dic, ResultCellElement cell ){
ExcelDictionary old = getSameDictionary(dic);
if( null == old ){
list.add(dic);
old = dic;
}
old.addCells(cell);
}
private ExcelDictionary getSameDictionary( ExcelDictionary dic ){
for( ExcelDictionary item : list ){
if( item.isSameDic(dic) ){
return item;
}
}
return null;
}
/**
* 生成所有数据字典的数据
* @return
* @throws Exception
*/
public List<ExcelDictionary> build()throws Exception{
for( ExcelDictionary item : list ){
item.build();
}
return list;
}
}