Workbook workbook = null;
workbook = WorkbookFactory.create(inputStream);
Sheet sheet = workbook.getSheetAt(0);
CellStyle cellStyle2 = workbook.createCellStyle();
//设置背景色
cellStyle2.setFillForegroundColor(IndexedColors.RED.getIndex());
cellStyle2.setFillBackgroundColor(IndexedColors.RED.getIndex());
cellStyle2.setFillPattern(FillPatternType.SOLID_FOREGROUND);
//设置字体居中
cellStyle2.setAlignment(HorizontalAlignment.CENTER);
cellStyle2.setVerticalAlignment(VerticalAlignment.CENTER);
sheet.getRow(row).getCell(column).setCellStyle(cellStyle2);
//创建单元格,并赋值
Cell cwyy_cell = sheet.getRow(1).createCell(sheet.getRow(1).getLastCellNum());
cwyy_cell.setCellValue("错误原因");
//设置单元格的内容类型,字符串、数字或者其它
sheet.getRow(row).getCell(column).setCellType(CellType.STRING);
//获取总行数、总列数
int row_num_total = sheet.getLastRowNum();
int column_num_total = sheet.getRow(1).getLastCellNum();