三角形横向时间轴定制

摘要: public List<MacInfo> importExcelWithMultipleSheet(InputStream is) throws Exception    {        this.type = Type.IMPORT;        this.wb = WorkbookFactory.create(is);        int sheetCount = wb.getNumberOfSheets();

public List importExcelWithMultipleSheet(InputStream is) throws Exception
{
this.type = Type.IMPORT;
this.wb = WorkbookFactory.create(is);
int sheetCount = wb.getNumberOfSheets();
List list = new ArrayList();
for(int c=0; c
Sheet sheet = wb.getSheetAt(c);
if (sheet == null){
throw new IOException("文件sheet不存在");
}
String sheetName = sheet.getSheetName();
if (StringUtils.isEmpty(sheetName)) {
throw new Exception("sheetName不能为空");
}

String[] oemModel = sheetName.split("-");
if (oemModel.length != 2) {
throw new Exception("sheetName命名不符合规范");
}

int rows = sheet.getPhysicalNumberOfRows();

if (rows > 0){
for (int i = 1; i < rows; i++)
{
// 从第2行开始取数据,默认第一行是表头. 第一列的数据就是MAC.
Row row = sheet.getRow(i);
T entity = null;

Object val = this.getCellValue(row, 0);
if (val != null) {
MacInfo obj = new MacInfo();
obj.setMac(val.toString());
obj.setModel(oemModel[1]);
obj.setOem(oemModel[0]);
list.add(obj);
}
}
}
}
return list;
}

上一篇: 在javascript中放弃indexOf, 用$.inArray吧
下一篇: POI读取大数据EXCEL思路
 评论 ( What Do You Think )
名称
邮箱
网址
评论
验证
   
 

 


  • 微信公众号

  • 我的微信

站点声明:

1、一号门博客CMS,由Python, MySQL, Nginx, Wsgi 强力驱动

2、部分文章或者资源来源于互联网, 有时候很难判断是否侵权, 若有侵权, 请联系邮箱:summer@yihaomen.com, 同时欢迎大家注册用户,主动发布无版权争议的 文章/资源.

3、鄂ICP备14001754号-3, 鄂公网安备 42280202422812号