首页 > 其他 > 详细

文件导入导出

时间:2019-09-27 19:45:14      阅读:195      评论:0      收藏:0      [点我收藏+]

导入:

public List<Shipment> readXls(InputStream is,Integer userId,Integer prodId) throws IOException,
InvalidFormatException {
List<Shipment> shipments=new ArrayList<Shipment>();
HSSFWorkbook book = new HSSFWorkbook(is);
HSSFSheet sheet = book.getSheetAt(0);

tRowNum()+1; i++) {
HSSFRow row = sheet.getRow(i);
row.getCell(0).setCellType(Cell.CELL_TYPE_STRING);
row.getCell(1).setCellType(Cell.CELL_TYPE_STRING);
row.getCell(2).setCellType(Cell.CELL_TYPE_STRING);
String uuid = row.getCell(0).getStringCellValue(); //名称
String dealerName = row.getCell(1).getStringCellValue(); //url
String prodName = row.getCell(2).getStringCellValue();
Shipment shipment=new Shipment();
shipment.setUuid(uuid);
shipment.setDealerName(dealerName);
shipment.setProdName(prodName);
shipment.setUserId(userId);
shipment.setProdId(prodId);
shipment.setCreated(new Date());
shipment.setUpdated(new Date());


shipments.add(shipment);
}

for (Shipment shipment : shipments) {
System.err.println(shipment);
}

return shipments;

}

文件导入导出

原文:https://www.cnblogs.com/kongfanbing/p/11599854.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!