import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import net.sf.jxls.exception.ParsePropertyException;
import net.sf.jxls.transformer.XLSTransformer;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
public class MakeXlsx {
// 模板地址 tempPath
// 真实导出路径 filePath
public static String toXls(List list, String tempPath, String filePath, HttpServletResponse response) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("root", list);
XLSTransformer transformer = new XLSTransformer();
try {
transformer.transformXLS(tempPath, map, filePath);
} catch (ParsePropertyException e1) {
e1.printStackTrace();
} catch (InvalidFormatException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}
FilesUtils.downLoad(filePath, response);
return null;
}
}
最后
以上就是腼腆萝莉最近收集整理的关于创建 xlx java的全部内容,更多相关创建内容请搜索靠谱客的其他文章。
发表评论 取消回复