开发者

Java: How to paste (append) an image on clipboard to a word document

Is there a way in Java, to copy the contents of the clipboard (an开发者_StackOverflow中文版 image in my case) to the end of a word document?

I want to have a program that will - * Take a filename (word file) as a parameter * Whenever this program is run - it will open the word file and paste the contents of the clipboard to the end of the document.

I am done with the first part - but am struggling with the second part. Also tried POI but could not get it to work.

Any help or pointers are greatly appreciated.

Regards, - Ashish


Haven't tested it, but I would try these steps:

After reading the document, try to read the image from the clipboard (you can have a look at this website: ToClipImg.html) and temporarily (File.createTempFile(...)) save the image to disk. It might be easier to save the image first and then add it with POI.


I don't know which library/code you're using for parsing the Word file, but Aspose.Words does a pretty good job parsing Word files. It's not free however, but it is rather straightforward to use, has decent enough documentation and a pretty solid forum-based helpdesk.

Check out their website. And no, I'm not an Aspose employee, it's just a good piece of software :)


http://poi.apache.org/hwpf/index.html

It is in early development but you can check it out in the SVN dir

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜