import java.io.File;
public class Test {
public static void main(String[] args) throws Exception {
File f = new File("d:/1.xls");
f.createNewFile();
}
}
好吧,之前没看到“用poi”这句话。现在下面的是用poi的:
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
public class Test {
public static void main(String[] args) {
try {
HSSFWorkbook workbook = new HSSFWorkbook();
FileOutputStream fileOut = new FileOutputStream("D:/2.xls");
workbook.write(fileOut);
fileOut.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
参考freespire.xls for java 的excel工作表创建方法