JAVA的poi实现模版导出excel
更新时间:2024-03-03 19:29:01 阅读量: 综合文库 文档下载
String accident_id = request.getParameter(\); String OnputimagePath = null;
/**************使用poi实现excel模版 导出excel********************/
try {
POIFSFileSystem fs = new POIFSFileSystem(new
FileInputStream(\设备异常分析报告.xls\)); HSSFWorkbook wb = new HSSFWorkbook(fs);
}
// 输出文件
OnputimagePath = \; FileOutputStream fileOut = new wb.write(fileOut); fileOut.close(); e.printStackTrace();
patri.createPicture(anchor ,wb.addPicture(byteArrayOut.toByteArra
HSSFSheet sheet = wb.getSheet(\设备异常分析报告\); HSSFRow row = sheet.getRow(2);
HSSFCell cell = row.getCell((short) 2); if (cell == null)
cell = row.createCell((short) 2);
cell.setCellType(HSSFCell.CELL_TYPE_STRING); cell.setCellValue(\);
ByteArrayOutputStream byteArrayOut = new String InputimagePath =
BufferedImage bufferImg = ImageIO.read(new ImageIO.write(bufferImg,\,byteArrayOut); //设置图片大小,位置
HSSFClientAnchor anchor = new
//创建
HSSFPatriarch patri = sheet.createDrawingPatriarch();
ByteArrayOutputStream();
\; File(InputimagePath));
HSSFClientAnchor(5,0,500,122,(short) 0, 5,(short)10,15);
y(), HSSFWorkbook.PICTURE_TYPE_PNG));
FileOutputStream(OnputimagePath);
} catch (Exception e) {
// 检查文件是否存在
File obj = new File(OnputimagePath); if (!obj.exists()) {
response.setContentType(\); response.getWriter().print(\指定文件不存在!\); return; }
// 读取文件名:用于设置客户端保存时指定默认文件名
int index = OnputimagePath.lastIndexOf(\); // 前提:传入的path
字符串以“\\”表示目录分隔符 String fileName = OnputimagePath.substring(index + 1);
// 写流文件到前端浏览器
ServletOutputStream out = response.getOutputStream(); response.setHeader(\, BufferedInputStream bis = null; BufferedOutputStream bos = null; try {
bis = new BufferedInputStream(new bos = new BufferedOutputStream(out); byte[] buff = new byte[2048]; int bytesRead;
while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) { bos.write(buff, 0, bytesRead); }
} catch (IOException e) { throw e; } finally {
if (bis != null) bis.close(); if (bos != null) bos.close(); }
\ + fileName);
FileInputStream(OnputimagePath));
正在阅读:
JAVA的poi实现模版导出excel03-03
中考课外文言文阅读及答案Microsoft Word 文档06-10
天麻的药理作用与临床应用05-13
最新语文版中职英语基础模块 下册unit 12《dedicated people》教04-14
成都市2013年高中阶段统一招生考试压轴题 (9)07-29
小学国庆节主题活动方案08-01
我喜欢的运动英语作文02-06
宝钢集团有限公司成本控制问题分析毕业设计06-14
2007年江苏造价员考试试题(基础部分)03-28
- 必修一物理寒假作业
- 2019-201X年5月大学生入党积极分子思想汇报-word范文模板(3页)
- 药物分析习题五
- 重拾应用意识 体会数学价值(沈建军)
- 2017全国高校辅导员结构化面试题集及参考答案
- 广东徐闻县实验中学2014届高三第二次月测地理试题
- 今天你共鸣了么?
- 2018-2019正能量读后感1000字-推荐word版(6页)
- 2018年中国截切型盖板针布行业专题研究分析报告目录
- 中国移动业务处理流程大全
- 公文写作常用词汇和句子集锦2016
- ARM课程设计说明书
- 教师资格证教育学论文
- 中考试卷分析
- 环境监测试卷(五)
- 党风廉政建设广播稿1
- 快速制作香香宫煮麻辣烫教程
- 《国际金融学》习题
- 文明施工保障措施方案
- 春兰维修资料故障代码
- 导出
- 模版
- 实现
- excel
- JAVA
- poi
- 优课资源为小学语文教学增添一抹亮色
- 北京市昌平区2006~2007学年第二学期初三化学一统考试
- 人教版三年级上册第二单元:万以内的加法和减法(一)
- 非遗民族民间歌舞展演主持词
- 行政管理专业知识训练试题及参考参考答案
- 公务员行测技巧-最快的时间找出正确的答案
- 如何做一个出彩的自我介绍
- 院团字〔2012〕2号关于举办2011级新生广播操比赛的通知
- 新闻宣传工作方案word版本(3页)
- 家具小区推广方案
- BC80配料控制器说明书 - 图文
- 《普罗米修斯》课堂实录
- 工程材料进场报审表1
- 第17章:秘书服务领导工作标准
- 山东大学威海2017年寒假值班安排表 - 图文
- 香港找工作必知的网站
- 东营市继续医学远程教育--基层医院手足口病的临床诊治经验答案
- 高考常用成语总结(上)
- 践行科学发展观 创新育人新理念
- 十三五重点项目-天然香精加工项目资金申请报告