| | |
| | | InputStream buffin = new ByteArrayInputStream(b);
|
| | | src = ImageIO.read(buffin);
|
| | | int widthYuan = src.getWidth(); // 得到源图宽
|
| | | int heightYuan = src.getHeight(); // 得到源图长
|
| | | picPX[i] = (double)widthYuan/heightYuan;
|
| | | int heightYuan = src.getHeight(); // 得到源图高
|
| | | //System.out.println("width:"+widthYuan+"\theight:"+heightYuan+"\t单元格宽:"+swidth+"\t单元格高"+sheight);
|
| | | picPX[i] = (double)widthYuan/(heightYuan*4);
|
| | | } catch (IOException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | sheet1.getRow(rownum).createCell(0).setCellValue(i>=picName.length?"":picName[i]);
|
| | | rownum++;
|
| | |
|
| | | HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 512, 255,(short) 0, rownum, (short) Math.ceil(10*picPX[i]), 25 + rownum-1);
|
| | | |
| | | HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 512, 255,(short) 0, rownum, (short) Math.ceil(25*picPX[i]), 25 + rownum-1);
|
| | | anchor.setAnchorType(3);
|
| | | patriarch.createPicture(anchor,wb.addPicture(bytes.get(i),HSSFWorkbook.PICTURE_TYPE_PNG));
|
| | | rownum+=26;
|