XSSF
ListallAIItems; // 将allAIItems写入excel,第一列为超链接(图片地址) try { // 定义输出流os,指向要生成的报告文件 OutputStream output = new FileOutputStream(file, true); // 创建生成EXEL文件的对象 XSSFWorkbook workbook = new XSSFWorkbook(); // 创建Excel工作表 指定名称和位置 XSSFSheet sheet = workbook.createSheet("sheet名称"); // 使用poi框架写入表头字段 XSSFCellStyle headStyle = sheet.getWorkbook().createCellStyle(); // 单元格设置样式 headStyle .setAlignment(HSSFCellStyle.ALIGN_CENTER); // 中间对齐 headStyle .setFillForegroundColor(HSSFColor.LIGHT_YELLOW.index); // 添加前景色 headStyle .setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); // 设置前景色显示样式 headStyle .setBorderBottom(HSSFCellStyle.BORDER_THIN); // 边框 headStyle .setBorderLeft(HSSFCellStyle.BORDER_THIN); headStyle .setBorderRight(HSSFCellStyle.BORDER_THIN); headStyle .setBorderTop(HSSFCellStyle.BORDER_THIN); // 定义Excel的表头 String[] title = { "第1个特征", "第2个特征", "第3个特征" }; // 第一行 Row row = sheet.createRow(0); // 定义cell Cell cell = null; for(int i=0; i 这个网址好!https://www.cnblogs.com/LiZhiW/p/4313789.html



