lurks
lurks

Reputation: 2606

How to programmatically extract and manipulate images from an Office file?

How to extract some images from PowerPoint and Word documents, in order to manipulate them, and after that, put the images back in the MS Office files?

Upvotes: 3

Views: 2456

Answers (4)

Brian Agnew
Brian Agnew

Reputation: 272377

Apache POI can handle Word documents via its HWPF module, and extract or insert images from these. Although it's not well documented, check out the POI unit tests for image manipulation within Word (the unit tests seem to be the best documentation for this module).

Failing that, the COM interface is accessible via (say) JACOB. That's probably more work, but will make available APIs not exposed via POI.

Upvotes: 3

Yishai
Yishai

Reputation: 91931

In terms of C++, Word exposes a COM API to allow you to manipulate its document format, so as long as you have Word installed on the machine, you can do this in C++ quite easily. Word isn't open source, but you probably have the license anyway.

Upvotes: 2

Tamar
Tamar

Reputation: 2066

The company I work for, SoftArtisans, has a product called OfficeWriter that allows you do that, among other things, for Word and Excel (PowerPoint is planned to be added in the future). It is not free or open sourced though.

On the other hand, if you are working strictly with 2007 format (XML based) you can probably use OpenXML.

Upvotes: 1

Brent Writes Code
Brent Writes Code

Reputation: 19623

Apache has a project called "POI" explicitly made for interacting with MS Office formats from Java. Hopefully that does it for you!

http://poi.apache.org/

Upvotes: 4

Related Questions