com.whaleal.icefrog.poi.excel.reader.ListSheetReader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of icefrog-poi Show documentation
Show all versions of icefrog-poi Show documentation
icefrog POI工具类(对MS Office操作)
The newest version!
package com.whaleal.icefrog.poi.excel.reader;
import com.whaleal.icefrog.core.collection.CollUtil;
import com.whaleal.icefrog.core.convert.Convert;
import org.apache.poi.ss.usermodel.Sheet;
import java.util.ArrayList;
import java.util.List;
/**
* 读取{@link Sheet}为List列表形式
*
* @author Looly
* @author wh
* @since 1.0.0
*/
public class ListSheetReader extends AbstractSheetReader>> {
/**
* 是否首行作为标题行转换别名
*/
private final boolean aliasFirstLine;
/**
* 构造
*
* @param startRowIndex 起始行(包含,从0开始计数)
* @param endRowIndex 结束行(包含,从0开始计数)
* @param aliasFirstLine 是否首行作为标题行转换别名
*/
public ListSheetReader( int startRowIndex, int endRowIndex, boolean aliasFirstLine ) {
super(startRowIndex, endRowIndex);
this.aliasFirstLine = aliasFirstLine;
}
@Override
public List> read( Sheet sheet ) {
final List> resultList = new ArrayList<>();
int startRowIndex = Math.max(this.startRowIndex, sheet.getFirstRowNum());// 读取起始行(包含)
int endRowIndex = Math.min(this.endRowIndex, sheet.getLastRowNum());// 读取结束行(包含)
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy