我使用java在excel中编写一些数据.我需要将特定的单元格包装为wrap.can任何告诉我包装文本的语法是什么以及如何使用它?
请参阅Apache POI
Workbook wb = new XSSFWorkbook();
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); //Wrapping text
cell.setCellStyle(cs);
Run Code Online (Sandbox Code Playgroud)