public class excelDemo {
public static void main(String[] args) {
try{
XSSFWorkbook wb = new XSSFWorkbook();
String s="ss";
String t="tt";
ArrayList array=new ArrayList();
array.add(s);
array.add(t);
XSSFSheet sheet;
for (int i = 0; i < 2; i++) {
sheet = wb.createSheet(array.get(i).toString());
for (int j = 0; j < 2; j++) {
XSSFRow row = sheet.createRow(j + 1);
row.createCell(0).setCellValue("ss");
}
}
//创建文件流
OutputStream stream = new FileOutputStream("G://12121.xlsx");
//写入数据
wb.write(stream);
//关闭文件流
stream.close();
}catch(Exception e) {
}
}
}
public static void main(String[] args) {
try{
XSSFWorkbook wb = new XSSFWorkbook();
String s="ss";
String t="tt";
ArrayList array=new ArrayList();
array.add(s);
array.add(t);
XSSFSheet sheet;
for (int i = 0; i < 2; i++) {
sheet = wb.createSheet(array.get(i).toString());
for (int j = 0; j < 2; j++) {
XSSFRow row = sheet.createRow(j + 1);
row.createCell(0).setCellValue("ss");
}
}
//创建文件流
OutputStream stream = new FileOutputStream("G://12121.xlsx");
//写入数据
wb.write(stream);
//关闭文件流
stream.close();
}catch(Exception e) {
}
}
}