Jave
Jave

Reputation: 46

How can i use poi to read ppt?

i find it supports well in Java,i can convert it to jpg; but when i use it in Android,bufferimage,graphics,imageio are not support becuase android drop the java.awt so if i want to use poi in android,how can i do tell me something useful, thks.

Upvotes: 0

Views: 1792

Answers (2)

John Smith
John Smith

Reputation: 851

swamy gave you rather useful link.

as of bufferedImage, you can adopt it and write your own adapter, as I did:

BufferedImage image = ImageIO.read(url);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write( image, "jpeg", baos );
baos.flush();
byte[] imageInByte = baos.toByteArray();
baos.close();

int idx = ppt.addPicture(imageInByte, XSLFPictureData.PICTURE_TYPE_JPEG);
XSLFPictureShape pic = xslfSlide.createPicture(idx);

Upvotes: 1

JasonPlutext
JasonPlutext

Reputation: 15863

I got docx4j (which can handle pptx) running on Android; see jaxb-can-be-made-to-run-on-android

The reason I mention this, is I had to overcome java.awt issues, which might help you. I repackaged as https://github.com/plutext/ae-awt

If you want to use that with POI, you'd have to alter the references in POI.

If you are just using pptx, you might find it easier to use docx4j (since with POI, you'll probably also need to get XML Beans working on Android).

Upvotes: 0

Related Questions