import java.io.FileOutputStream; import java.io.IOException; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.DataFormat; import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.VerticalAlignment; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class PoiBug { public static void main(String[] args) { try (Workbook wb = new XSSFWorkbook()) { Sheet sheet = wb.createSheet(); Row row = sheet.createRow(3); CellStyle headingStyleCenter = wb.createCellStyle(); DataFormat df = wb.createDataFormat(); short dfText = df.getFormat("@"); headingStyleCenter.setDataFormat(dfText); headingStyleCenter.setWrapText(true); headingStyleCenter.setRotation((short) 90); headingStyleCenter.setVerticalAlignment(VerticalAlignment.BOTTOM); headingStyleCenter.setAlignment(HorizontalAlignment.CENTER); Cell c = row.createCell(16383); c.setCellStyle(headingStyleCenter); c.setCellValue("TABLE OVERFLOW"); try (FileOutputStream out = new FileOutputStream("bug.xlsx")) { wb.write(out); } } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }