Workbook wb = new XSSFWorkbook(); //or new HSSFWorkbook(); Sheet sheet = wb.createSheet(); Row row = sheet.createRow(2); Cell cell = row.createCell(2); cell.setCellValue("Use \n with word wrap on to create a new line"); CellStyle cs = wb.createCellStyle(); cs.setWrapText(true); //关键 cell.setCellStyle(cs); //单元格应用设置的style