POI无法提取出word2007中的图片吗 请教:POI能否提取word2007中的图片。能给出实例吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public void extractImage(String wordDocxPath){ FileInputStream fis=null; FileOutputStream fos=null; OPCPackage opcPackage=null; XWPFDocument xwpfd =null; File file=null; file=new File(wordDocxPath); try { String imgPath =file.getParent()+File.separator+"img"; //载入文档 fis = new FileInputStream(wordDocxPath); opcPackage= POIXMLDocument.openPackage(wordDocxPath); xwpfd= new XWPFDocument(opcPackage); //建立图片文件目录 File imgFile = new File(imgPath); if(!imgFile.exists()){ imgFile.mkdir(); } //获取所图片 // List piclist = xwpfd.getAllPictures(); for(int j = 0; j < piclist.size(); j++){ XWPFPictureData pic = (XWPFPictureData) piclist.get(j) ; //获取图片数据流 byte[] picbyte = pic.getData(); //将图片写入本地文件 fos = new FileOutputStream(imgPath +file.separator+ file.getName()+j +".jpg"); fos.write(picbyte); } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } List piclist = xwpfd.getAllPictures();老出错啊,请指教 List piclist = xwpfd.getAllPictures();解析word2007,没有此方法啊,我的jar包。还是有其他的jar包 XWPFDocument xwpfd=new XWPFDocument(opcPackage);xwpfd.getAllPictures();jar包中没此方法啊。org.apache.poi.xwpf.usermodel中无此方法啊。 关于io流 关于传值为地址的一个问题 字符相似度 百万数据如何高效率导入数据库 求助!!!!在线等!!! 菜鸟学JAVA ,问个想不明白的小问题? 绝对路径,相对路径 大家帮帮忙(求java写的词法分析程序) 高手进来看看!!? 超难度的报表! 请问一下,JAVA里面,怎么确定一串字符中第一个数字位是第几位!!!!谢谢 【求助】【各种求助】 如何获取别的类的public static 方法里的局部变量
public void extractImage(String wordDocxPath){
FileInputStream fis=null;
FileOutputStream fos=null;
OPCPackage opcPackage=null;
XWPFDocument xwpfd =null;
File file=null;
file=new File(wordDocxPath);
try {
String imgPath =file.getParent()+File.separator+"img";
//载入文档
fis = new FileInputStream(wordDocxPath);
opcPackage= POIXMLDocument.openPackage(wordDocxPath);
xwpfd= new XWPFDocument(opcPackage);
//建立图片文件目录
File imgFile = new File(imgPath);
if(!imgFile.exists()){
imgFile.mkdir();
}
//获取所图片
//
List piclist = xwpfd.getAllPictures();
for(int j = 0; j < piclist.size(); j++){
XWPFPictureData pic = (XWPFPictureData) piclist.get(j) ;
//获取图片数据流
byte[] picbyte = pic.getData();
//将图片写入本地文件
fos = new FileOutputStream(imgPath +file.separator+ file.getName()+j +".jpg");
fos.write(picbyte);
}
}
catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
xwpfd.getAllPictures();jar包中没此方法啊。org.apache.poi.xwpf.usermodel中无此方法啊。