我用HSSF工作簿用java把数据写到excel中,现在我有了一个列名,字号为n-no,如果我把它通常插入到同一行中,我想把句子分成两行,插入到同一个单元格中。
下面是iam用于设置列的代码
rowhead.createCell((short) 0).setCellValue("Hi there it is my lengthy column please help");谢谢,汤姆
发布于 2014-05-28 15:10:23
您只需使用Java新行'\n' char将句子拆分为2行,然后将WrapText设置为true
Cell cell = rowhead.createCell((short) 0));
cell.setCellValue("Hi there it is my lengthy \n column please help");
CellStyle cs = wb.createCellStyle();
cs.setWrapText(true);
cell.setCellStyle(cs);https://stackoverflow.com/questions/23915210
复制相似问题