-
StackOverflow 文件
-
apache-poi 教程
-
簡單 Excel(XLSX) 建立
-
基本 Excel
String fileName = "Fruit.xlsx";
String sheetName = "Apples";
XSSFWorkbook wb = new XSSFWorkbook();
XSSFSheet sheet = wb.createSheet(sheetName) ;
for (int r=0;r < 3; r++ )
{
XSSFRow row = sheet.createRow(r);
//iterating c number of columns
for (int c=0;c < 3; c++ )
{
XSSFCell cell = row.createCell(c);
cell.setCellValue("Nice apple, in row: "+r+" and col: "+c);
}
}
try(FileOutputStream fos = new FileOutputStream(fileName))
{
wb.write(fos);
}