Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void excelWriter (String file){
- try {
- FileInputStream fileInputStream = new FileInputStream(file);
- XSSFWorkbook workbook = new XSSFWorkbook(fileInputStream);
- XSSFSheet sheet = workbook.getSheetAt(0);
- for (int i = 0; i < letterCount[0].length; i++){
- Row row = sheet.createRow(i+1);
- Cell cell = row.createCell(0);
- cell.setCellValue(letterCount[0][i]);
- for (int j = 0; j < letterCount.length; j++){
- cell = row.createCell(j+1);
- cell.setCellValue(letterCount[j][i]);
- }
- fileInputStream.close();
- FileOutputStream fileOutputStream = new FileOutputStream(file);
- workbook.write(fileOutputStream);
- workbook.close();
- fileOutputStream.close();
- }
- } catch (Exception e){
- System.out.println(e.getMessage());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement