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中无此方法啊。 这个是不是死循环呢 一个关于继承的基础问题 java画布问题 制表符\t在JOptionPane中为什么不起作用? 求解Public static与Private static的区别 怎么样用JAVA实现多现成编程打印20以内的奇数和偶数啊 各位java老大,帮忙看看这个老师布置的试验该怎么写啊?多谢了 急:在程序中如何获取一个网页的代码? 如何unload当前被系统调用的Com控件的Dll? 新手求助!!!!!!拜托拜托 【求助】【各种求助】 如何获取别的类的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中无此方法啊。