1.導包
2.源碼
public class POITest {
public static void main(String[] args) throws Exception {
Workbook wb = new HSSFWorkbook();
Sheet sheet = wb.createSheet();
Row row = sheet.createRow(3);
Cell cell = row.createCell(3);
cell.setCellValue("嘟嘟嘟.哈哈哈");
CellStyle cellStyle = wb.createCellStyle();
Font font = wb.createFont();
font.setFontName("華文行楷");
font.setFontHeightInPoints((short)48);
cellStyle.setFont(font);
cell.setCellStyle(cellStyle);
OutputStream os = new FileOutputStream("D:/筆記/abc.xls");
wb.write(os);
os.close();
System.out.println("導出成功");
}
}
3.效果