You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
<%@ page import="java.io.File" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
// 模板注意 用{} 来表示你要用的变量 如果本来就有"{","}" 特殊字符 用"\{","\}"代替
String templateFileName =
"D:" + File.separator + "WEAVER8090" + File.separator + "ecology" + File.separator + "filesystem" + File.separator + "" +
"workflowexport" + File.separator + "stencil" + File.separator + "simple.xlsx";
// 方案1 根据对象填充
String fileName = "D:" + File.separator + "WEAVER8090" + File.separator + "ecology" + File.separator + "filesystem" + File.separator + "" +
"workflowexport" + File.separator + "stencil" + File.separator + System.currentTimeMillis() + ".xlsx";
// 这里 会填充到第一个sheet, 然后文件流会自动关闭
List<FillData> list = new ArrayList<>();
FillData fillData = new FillData();
fillData.setName("张三");
fillData.setAge("99");
list.add(fillData);
fillData = new FillData();
fillData.setName("李四");
fillData.setAge("199");
list.add(fillData);
EasyExcel.write(fileName).withTemplate(templateFileName).sheet().doFill(list);
%>