创建 xlx java
来源:互联网 发布:能听裂空小说软件 编辑:程序博客网 时间:2024/05/22 10:40
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;
}
}
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;
}
}
1 0
- 创建 xlx java
- java 创建文件-创建目录-创建临时文件
- 【java】创建文件夹,创建文件
- java对象创建过程
- 如何创建java泛型
- java Application创建图形界面
- Java 线程创建
- 创建Java应用程序
- java创建线程池
- java创建线程池
- java创建文件夹
- Effective Java --- 创建对象
- java创建XML文件
- java创建对象数组
- java创建删除文件夹
- java自动创建XML
- java 创建 快捷方式
- java创建临时文件
- 如何判断js中的数据类型
- zzuli oj 1873: This offer 【dfs+数组标记技巧(set会超时)】
- hdu2444The Accomodation of Students【判断二分图+最大匹配】
- SharedPreferences
- python @ property classmethod staticmethod
- 创建 xlx java
- Java 将15位身份证号转化为18位返回,非15位身份证号原值返回
- javascript去除字符串左右两端的空格
- 215. Kth Largest Element in an Array
- mac下安装brew遇到的问题总结
- 类目和延展的作用和区别?
- POJ 3421X-factor Chains【分解质因子+组合数学】
- 3D Touch
- 总结一下java中的位操作,运算优先级