一、复制模板
private static File createNewFile() {
// 读取模板,并赋值到新文件************************************************************
// 文件模板路径
String path = (getSispPath());
File file = new File(path);
if (!file.exists()) {
logger.error("原模板文件不存在");
System.out.println("原模板文件不存在");
}
// 保存文件的路径
String realPath = file.getParent();
// 新的文件名
String newFileName = "statement-" + System.currentTimeMillis() + ".xlsx";
// 判断路径是否存在
File dir = new File(realPath);
if (!dir.exists()) {
dir.mkdirs();
}
// 写入到新的excel
File newFile = new File(realPath, newFileName);
try {
newFile.createNewFile();
// 复制模板到新文件
fileChannelCopy(file, newFile);
} catch (Exception