// 将数据放入map类型的集合中
List<Map<String, Object>> dataList = new ArrayList<Map<String, Object>>();
String[] assetHeadTemp = { "商品名称", "销量", "库存", "周转率", "图片" };
String[] assetNameTemp = { "maktx", "saleCount", "stockCount", "rotationRate", "matnr" };
Workbook wb = new SXSSFWorkbook(100);
Sheet sheet = wb.createSheet("Sheet1");
Row row;
Cell cell;
// 图片字节数组
byte[] imgByte = null;
// excel样式
CellStyle style = wb.createCellStyle();
style.setAlignment(CellStyle.ALIGN_CENTER);// 水平
style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);// 垂直
// 输出表头
row = sheet.createRow(0);
for (int i = 0; i < assetHeadTemp.length; i++) {
cell = row.createCell(i);
cell.setCellValue(assetHeadTemp[i]);
cell.setCellStyle(style);
}
// 输出内容
int rowIndex = 1;
for (Map&l
SXSSFWorkbook 导出大批量数据和图片到excel
最新推荐文章于 2024-02-05 14:39:35 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)