poi获取图片位置
2015-03-31 00:07
211 查看
参考资料:http://stackoverflow.com/questions/28288104/how-to-know-the-image-or-picture-location-while-parsing-ms-word-doc-in-java-usin
内容:
You're getting at the pictures the wrong way, which is why you're not finding any positions!
What you need to do is process each
CharacterRun of the document in turn. Pass that to the
PicturesTable, and check if the character run has a picture in. If it does, fetch back the picture from the table, and you know where in the document it belongs as you have the run it comes from
At the simplest, it'd be something like:
but,Picture picture = pictures.getFor(cr)有错误,不知道是不是因为版本问题,解决:
Picture picture = pictureTable.extractPicture(cr, true);
i第几行,(纵坐标)
j为第几个(横坐标)
j的单位是字符。
内容:
You're getting at the pictures the wrong way, which is why you're not finding any positions!
What you need to do is process each
CharacterRun of the document in turn. Pass that to the
PicturesTable, and check if the character run has a picture in. If it does, fetch back the picture from the table, and you know where in the document it belongs as you have the run it comes from
At the simplest, it'd be something like:
PicturesTable pictureTable = document.getPicturesTable(); Range r = document.getRange(); for(int i=0; i<r.numParagraphs(); i++) { Paragraph p = r.getParagraph(i); for(int j=0; j<p.numCharacterRuns(); j++) { CharacterRun cr = p.getCharacterRun(j); if (pictureTable.hasPicture(cr)) { Picture picture = pictures.getFor(cr); // Do something useful with the picture } } }
but,Picture picture = pictures.getFor(cr)有错误,不知道是不是因为版本问题,解决:
Picture picture = pictureTable.extractPicture(cr, true);
i第几行,(纵坐标)
j为第几个(横坐标)
j的单位是字符。
相关文章推荐
- 用POI获取excel表中的图片位置及数据
- 利用POI获取Excel中图片和图片位置(支持excel2003or2007多sheet)
- 利用POI获取Excel中图片和图片位置
- 关于POI对Excel2007中图片的处理,获取图片在excel中对应的位置
- zk框架获取POI Excel图片 以及 设置图片位置和大小的方法
- poi获取Excel表中图片位置
- 转:通过 POI 获取图片在 Excel 表格中的位置
- 获取鼠标在图片坐标位置的小例子
- UIWebView之获取所点位置图片URL
- UIWebView之获取所点位置图片URL
- 获取图片水印位置下接框(PHP代码函数)
- 获取mp3专辑图片的位置
- UIWebView之获取所点位置图片URL
- 根据identifier从StoryBoard中获取对象,UIButton的图片文件位置
- poi获取excel图片(excel2003,excel2007)
- UIWebView之获取所点位置图片URL
- js获取浏览器宽高、网页宽高、屏幕宽高、鼠标位置等(带图片说明)
- UIWebView之获取所点位置图片URL
- 详解使用UIWebView获取所点位置图片URL教程
- jQuery获取当前鼠标相对位置坐标和点击图片跳转上一张或下一张功能