【poi】怎样通过poi获得word中图片的位置,然后将图片的位置换成文本字样“图片”

lgq_0714 2010-01-21 11:13:00
怎样通过poi获得word中图片的位置,然后将图片的位置换成文本字样“图片”
...全文
973 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
Vhero 2011-08-09
  • 打赏
  • 举报
回复
Picutre.suggestFileExtension()是获取后缀名。
但我也很想知道怎吗将图片去掉,分析Paragraph.text()取出的值,但赶紧不可行,不知LZ现在实现木有
victoryzjs 2011-08-01
  • 打赏
  • 举报
回复
研究了一下,但是没有发现这个没有提供获得原图片后缀名的方法。继续搜索
yang85824 2011-07-14
  • 打赏
  • 举报
回复
怎么往里写图片啊兄弟们???到处都是读取的方法,就是没有往里写的
Mirage520 2010-05-24
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 warison2008 的回复:]
昨天用poi写的一个读取word中图片的程序给你参考下,
需要poi-scratchpad-3.6-20091214.jar,
poi-3.6-20091214.jar.
public static void main(String[] args) {


try {
String path = "image.doc";
FileInputStream in = new FileI……
[/Quote]

===================================
这个不是坐标,是缩放比率,还得继续找,楼主知道了吗? 知道回复我一下哈
p.getAspectRatioX();//x坐标缩放的比率
p.getAspectRatioY();//y坐标缩放的比率
lgq_0714 2010-01-24
  • 打赏
  • 举报
回复




up
lgq_0714 2010-01-23
  • 打赏
  • 举报
回复
谢谢各位了


继续求解。。。。。。。。
acridin 2010-01-22
  • 打赏
  • 举报
回复
crazylaa 2010-01-22
  • 打赏
  • 举报
回复
看看1楼的
PicturesTable pic = doc.getPicturesTable();

List pictureList = pic.getAllPictures();
System.out.println(pictureList.size());
BufferedOutputStream output = null;
for (int i = 0; i < pictureList.size(); i++) {
Picture p = (Picture) pictureList.get(i);
//System.out.println(p.get());

这里面有没有对应的delete方法咯,有就删掉,在对应的位置放文字。。

没弄过的帮顶了
gz116 2010-01-22
  • 打赏
  • 举报
回复
关注....
lgq_0714 2010-01-22
  • 打赏
  • 举报
回复
继续求解
。。。。。
。。。。。。。。。
谁是莫默的呢 2010-01-22
  • 打赏
  • 举报
回复
帮顶..
lgq_0714 2010-01-21
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 warison2008 的回复:]
昨天用poi写的一个读取word中图片的程序给你参考下,
需要poi-scratchpad-3.6-20091214.jar,
poi-3.6-20091214.jar.
public static void main(String[] args) {


try {
String path = "image.doc";
FileInputStream in = new FileInputStream(new File(path));
HWPFDocument doc = new HWPFDocument(in);
// doc.
PicturesTable pic = doc.getPicturesTable();

List pictureList = pic.getAllPictures();
System.out.println(pictureList.size());
BufferedOutputStream output = null;
for (int i = 0; i < pictureList.size(); i++) {
Picture p = (Picture) pictureList.get(i);
//System.out.println(p.get());
p.getAspectRatioX();//x坐标
p.getAspectRatioY();//y坐标
p.getHeight();//高度
p.getWidth();//宽读
output = new BufferedOutputStream(new FileOutputStream(
"E:\\data\\" + (i + 1) + ".jpg"));
output.write(p.getContent());
output.flush();
output.close();
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
[/Quote]
怎样将word中的图片替换成文字啊?请高手指点
道光2008 2010-01-21
  • 打赏
  • 举报
回复
昨天用poi写的一个读取word中图片的程序给你参考下,
需要poi-scratchpad-3.6-20091214.jar,
poi-3.6-20091214.jar.
public static void main(String[] args) {


try {
String path = "image.doc";
FileInputStream in = new FileInputStream(new File(path));
HWPFDocument doc = new HWPFDocument(in);
// doc.
PicturesTable pic = doc.getPicturesTable();

List pictureList = pic.getAllPictures();
System.out.println(pictureList.size());
BufferedOutputStream output = null;
for (int i = 0; i < pictureList.size(); i++) {
Picture p = (Picture) pictureList.get(i);
//System.out.println(p.get());
p.getAspectRatioX();//x坐标
p.getAspectRatioY();//y坐标
p.getHeight();//高度
p.getWidth();//宽读
output = new BufferedOutputStream(new FileOutputStream(
"E:\\data\\" + (i + 1) + ".jpg"));
output.write(p.getContent());
output.flush();
output.close();
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
xuexijava 2010-01-21
  • 打赏
  • 举报
回复
关注 学习 加顶
wenfei208 2010-01-21
  • 打赏
  • 举报
回复
关注。
lgq_0714 2010-01-21
  • 打赏
  • 举报
回复
up


请各位高手帮忙看看!

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧