中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

使用POI向excel中寫入圖片的java代碼

2018-07-20    來源:open-open

容器云強勢上線!快速搭建集群,上萬Linux鏡像隨意使用
List headlist = this.getCS_HEAD(allFactoryNo);
HSSFSheet sheet = workbook.createSheet();
sheet.setColumnWidth((short)0, 6000);
sheet.setColumnWidth((short)1, 10000);
HSSFRow row3 = sheet.createRow(3);
HSSFPatriarch pa = sheet.createDrawingPatriarch();    //增加多個圖片時只需要創(chuàng)建一個對象
HSSFRow row4 = sheet.createRow(4);
HSSFCell cell40 = row4.createCell(0);
cell40.setCellValue("編碼");
HSSFCell cell41 = row4.createCell(1);
cell41.setCellValue("名稱");
for(int i=0;i<headlist.size();i++){
Cs_head cshead = (Cs_head) headlist.get(i);
SmbFile smbFile = new SmbFile("smb://erp002:erp002@IP/cac_phot/"+cshead.getProduct());//訪問網絡共享文件
InputStream is = smbFile.getInputStream();
int x1=0;
int y1=0;
int x2=x1+255;
int y2=y1+255;
HSSFClientAnchor anchor = new HSSFClientAnchor(x1,y1,x2,y2,(short)(2+(i*2)),0,(short)(4+(i*2)),2);
anchor.setAnchorType(2);
BufferedImage bi = ImageIO.read(is);
ByteArrayOutputStream bout=new ByteArrayOutputStream();
ImageIO.write(bi,"JPG",bout);
pa.createPicture(anchor , workbook.addPicture(bout.toByteArray(),HSSFWorkbook.PICTURE_TYPE_JPEG));

標簽: 網絡

版權申明:本站文章部分自網絡,如有侵權,請聯系:west999com@outlook.com
特別注意:本站所有轉載文章言論不代表本站觀點!
本站所提供的圖片等素材,版權歸原作者所有,如需使用,請與原作者聯系。

上一篇:Go語言標準庫Json的使用.

下一篇:C# socket通信實現兩個控制臺之間聊天