Hello, I'm getting the following message when I try to open a ppt I
saved after it was streamed from a servlet:
PowerPoint can't open test.ppt because part of the file is missing
Here is my servlet code. It simply creates a slide show from an input
stream and adds an image to slide 15:
ServletOutputStream out = response.getOutputStream();
InputStream uploadedStream = null;
ByteArrayInputStream bais = null;
// a little clumsy here
ByteArrayOutputStream baos = new ByteArrayOutputStream();
fp.writeTo(baos);
byte[] ppt = baos.toByteArray();
bais = new ByteArrayInputStream(ppt);
SlideShow ppt = new SlideShow(new HSLFSlideShow(bais));
byte[] pngArray =
controller.writePNGToByteArray(DOMDocument);
int index = ppt.addPicture(pngArray, Picture.PNG);
Picture pict = new Picture(index);
pict.setAnchor(new java.awt.Rectangle(195, -11, 400,
633));
Slide slide = null;
slide = ppt.getSlides()[14];
slide.addShape(pict);
DOMDocument = null;
}
ppt.write(out);
out.flush();
out.close();
It's all pretty simple. Perhaps it's my handling of the ByteArray
Input/Output Streams.
Any help would be appreciated.
Regards,
Eric Hamacher
******************************
THIS EMAIL IS INTENDED ONLY FOR THE REVIEW OF THE ADDRESSEE(S), AND MAY
CONTAIN CONFIDENTIAL AND LEGALLY PRIVILEGED INFORMATION. INTERCEPTION,
COPYING, DISSEMINATION, OR OTHER USE BY OTHER THAN THE ADDRESSEE(S) IS
PROHIBITED AND MAY BE PENALIZED UNDER APPLICABLE PRIVACY LAWS. IF YOU
RECEIVED THIS EMAIL IN ERROR, PLEASE DELETE IT AND NOTIFY ME BY RETURN
EMAIL TO [EMAIL PROTECTED] *******************************