Apache POI可以为你做到这一点。特别是HSSF模块。该快速指南是最有用的。这是你想做什么的方法-专门创建一张纸并将其写出来。
Workbook wb = new HSSFWorkbook();//Workbook wb = new XSSFWorkbook();CreationHelper createHelper = wb.getCreationHelper();Sheet sheet = wb.createSheet("new sheet");// Create a row and put some cells in it. Rows are 0 based.Row row = sheet.createRow((short)0);// Create a cell and put a value in it.Cell cell = row.createCell(0);cell.setCellValue(1);// Or do it on one line.row.createCell(1).setCellValue(1.2);row.createCell(2).setCellValue(createHelper.createRichTextString("This is a string"));row.createCell(3).setCellValue(true);// Write the output to a fileFileOutputStream fileOut = new FileOutputStream("workbook.xls");wb.write(fileOut);fileOut.close();


