public static String writeFile(String fileName, String[][] content) {
WritableWorkbook wwb = null;
String filePath = fileName+".xls";
try {
wwb = Workbook.createWorkbook(new File(filePath));
} catch (IOException e) {
e.printStackTrace();
}
if (wwb != null) {
WritableSheet ws = wwb.createSheet(fileName, 1);
for (int row = 0; row < content.length; row++) {
for (int j = 0; j < content[row].length; j++) {
Label labelC = new Label(j, row, content[row][j]);
try {
ws.addCell(labelC);
} catch (RowsExceededException e) {
e.printStackTrace();
} catch (WriteException e) {
e.printStackTrace();
}
}
System.out.println(row);
}
try {
wwb.write();
wwb.close();
return filePath;
} catch (IOException e) {
e.printStackTrace();
} catch (WriteException e) {
e.printStackTrace();
}
}
return null;
}