Return-Path: Delivered-To: apmail-poi-user-archive@www.apache.org Received: (qmail 73578 invoked from network); 20 Jan 2010 17:20:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 20 Jan 2010 17:20:34 -0000 Received: (qmail 66873 invoked by uid 500); 20 Jan 2010 17:20:33 -0000 Delivered-To: apmail-poi-user-archive@poi.apache.org Received: (qmail 66860 invoked by uid 500); 20 Jan 2010 17:20:33 -0000 Mailing-List: contact user-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "POI Users List" Delivered-To: mailing list user@poi.apache.org Received: (qmail 66850 invoked by uid 99); 20 Jan 2010 17:20:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Jan 2010 17:20:33 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jdente@21technologies.com designates 72.29.211.230 as permitted sender) Received: from [72.29.211.230] (HELO 21ctexg01.21technologies.com) (72.29.211.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Jan 2010 17:20:25 +0000 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01CA99F4.CDE5E218" Subject: 3rd PowerPoint Slide is Corrupt Date: Wed, 20 Jan 2010 11:20:03 -0600 Message-ID: <54D41E91F26CF6488C7088C89D9160F80194342C@21ctexg01.21technologies.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: 3rd PowerPoint Slide is Corrupt Thread-Index: AcqZ9M2EiOV0xLaCRnikcxldBXu3Rg== From: "Joe Dente" To: X-Virus-Checked: Checked by ClamAV on apache.org ------_=_NextPart_001_01CA99F4.CDE5E218 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, =20 I'm using the POI project to generate some PowerPoint slides. It works fine until I generate the 3rd slide for my slide deck, which ends up being corrupted every time. The first time my program runs it creates a new slide deck and adds a single slide to it. After that, every time the program runs it grabs the slide deck generated during the first run and appends a single slide to it. After the first run of the program the slide deck is fine. After the second run it is fine as well. The third run generates a corrupt slide every time. For testing purposes I changed my program so that all 3 runs of the program are generating the identical blank slide and yet this corruption still happens, so it does not appear to have anything to do with my slide contents. I am following the code samples given on the POI website under "Shapes How To": =20 To create the slide deck during the first run: SlideShow ppt =3D new SlideShow(); =20 To connect to an existing slide deck during subsequent runs: SlideShow ppt =3D null; File pptFile =3D new File(pptFileName); if(pptFile.exists()) { if(pptFile.canWrite()) { //construct the ppt from an existing file ppt =3D new SlideShow(new FileInputStream(pptFile)); } else { throw new IOException("Unable to write to the PowerPoint file '" + pptFileName + "'"); } } =20 To add a blank slide to the slide deck (nothing fancy here): Slide slide =3D ppt.createSlide(); =20 To save my slide deck after adding a slide: FileOutputStream out =3D new FileOutputStream(pptFileName); ppt.write(out); out.close(); =20 This all seems very straightforward and so I am not sure why the third slide is always corrupted. Also, if I use my program to generate 2 slides and then I add a third slide through PowerPoint, I can continue adding slides to the slide deck without any corruption. I can also create a blank slide deck through PowerPoint and then use my program to append blank slides to the deck and no corruption happens. So this leads me to believe it has something to do with the saving of my PowerPoint slide deck, since whenever I save it through PowerPoint the corruption does not occur. =20 I appreciate any help. Thanks in advance. Joe ------_=_NextPart_001_01CA99F4.CDE5E218--