String imageUrl = imgElement.attribute(new QName("src")).getValue();
InputStream is = null;
try{
is = new FileInputStream("E:\\Midea-MPM\\image\\279400860.wmf");
byte[] bytes = IOUtils.toByteArray(is);
int pictureIdx = workbook.addPicture(bytes, workbook.PICTURE_TYPE_WMF);
// 图片插入坐标
anchor.setCol1(readColNo);
anchor.setRow1(tr_idx);
anchor.setCol2(readColNo + colspan - 1);
anchor.setRow2(rowspan + tr_idx - 1);
// 插入图片
HSSFPicture pict = drawingPatriarch.createPicture(anchor, pictureIdx);
pict.resize();
}catch(Exception e){
throw e;
}finally{
if(is != null){
is.close();
is = null;
}
}
有做个类似功能的,请指教一下~ 重点是WMF格式的图片