<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.2</version>
</dependency>
XSSFWorkbook workbook = new XSSFWorkbook();
XSSFSheet sheet = workbook.createSheet("시트이름");
시트
XSSFRow xssfRow = XSSFSheet.createRow(n);
Cell cell = XSSFRow.createCell(n);
XSSFFont font = xssfWb.createFont();
Font.setFontName("글꼴");
Font.setFontHeightInPoints((short)n);
Font.setBold(true);
cellStyle.setFont(Font);
CellStyle cellStyle = workbook.createCellStyle();
cellStyle.setAlignment(HorizontalAlignment.CENTER);
cellStyle.setBorderRight(BorderStyle.THIN);
cellStyle.setBorderLeft(BorderStyle.THIN);
cellStyle.setBorderTop(BorderStyle.THIN);
cellStyle.setBorderBottom(BorderStyle.THIN);
XSSFCell xssfCell = null;
XSSFSheet.addMergedRegion(new CellRangeAddress(첫행, 마지막행, 첫열, 마지막열))
xssfCell.setCellStyle(cellStyle);
xssfCell.setCellValue("셀에 넣을 내용");