POI在Excel中插入图片
来源:互联网 发布:宇宙大小的相关数据 编辑:程序博客网 时间:2024/04/26 21:29
POI下载地址
http://www.fayea.com/apache-mirror/poi/release/bin/poi-bin-3.9-20121203.tar.gz
public static void main(String[] args) {FileOutputStream fileOut = null; BufferedImage bufferImg =null; BufferedImage bufferImg1 = null; try {//读取图片ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream(); ByteArrayOutputStream byteArrayOut1 = new ByteArrayOutputStream(); bufferImg = ImageIO.read(new File("e:/nanjing.jpg")); bufferImg1 = ImageIO.read(new File("e:/nanjing.jpg")); ImageIO.write(bufferImg,"jpg",byteArrayOut); ImageIO.write(bufferImg1,"jpg",byteArrayOut1); //创建excel HSSFWorkbook excelfile = new HSSFWorkbook();HSSFSheet excelsheet=excelfile.createSheet();excelfile.setSheetName(0, "aaa");//设置图片位置 HSSFPatriarch patriarch = excelsheet.createDrawingPatriarch(); HSSFClientAnchor anchor = new HSSFClientAnchor(0,0,512,255,(short) 1,1,(short)10,20); HSSFClientAnchor anchor1 = new HSSFClientAnchor(0,0,512,255,(short) 2,30,(short)10,60); patriarch.createPicture(anchor , excelfile.addPicture(byteArrayOut.toByteArray(),HSSFWorkbook.PICTURE_TYPE_JPEG)); patriarch.createPicture(anchor1 , excelfile.addPicture(byteArrayOut1.toByteArray(),HSSFWorkbook.PICTURE_TYPE_JPEG)); //输出到磁盘 fileOut = new FileOutputStream("E:/1/t"+System.currentTimeMillis()+".xls");excelfile.write(fileOut);fileOut.close();} catch (FileNotFoundException e) {System.out.println(e.getLocalizedMessage());} catch (IOException e) {System.out.println(e.getLocalizedMessage());}}
- POI在Excel中插入图片
- 使用POI在EXCEL中插入图片
- java poi 在excel中插入图片
- poi如何在excel中插入图片
- 使用POI生成Excel文件及使用POI在EXCEL文件中插入图片的方法
- 使用POI生成Excel文件及使用POI在EXCEL文件中插入图片的方法
- Apache POI向excel中插入图片
- poi excel 插入图片
- 在Excel中插入图片
- POI插入EXCEL图片【成功】
- POI实现Excel插入图片
- JAVA实现在excel插入图片(POI模式)
- 使用POI向Excel中插入多张图片
- java POI实现向Excel中插入图片
- java POI实现向Excel中插入图片
- java POI实现向Excel中插入图片
- java POI实现向Excel中插入图片
- 用POI向Excel中插入图片的例子
- Mysql5.6特性之细解--- DDL online operate
- 数字图像处理3---图像基本运算--续
- JBPM学习(一)--与SSH整合
- Twisted requires zope.interface
- POJ 3258 River Hopscotch
- POI在Excel中插入图片
- 一行代码实现在线编辑器
- android中openMax的实现
- Android ramdisk.img system.img userdata.img
- adb 常用命令大全
- SAP SMARTFORMS 打印 CNSAPWIN 不支持页格式
- ThreadLocal实现方式&使用介绍---无锁化线程封闭
- EXTJS中的store获取额外的值
- extjs 4 tree 的text不显示