Return-Path: X-Original-To: apmail-poi-dev-archive@www.apache.org Delivered-To: apmail-poi-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CC9A4826D for ; Sun, 11 Sep 2011 13:25:25 +0000 (UTC) Received: (qmail 23647 invoked by uid 500); 11 Sep 2011 13:25:25 -0000 Delivered-To: apmail-poi-dev-archive@poi.apache.org Received: (qmail 23568 invoked by uid 500); 11 Sep 2011 13:25:24 -0000 Mailing-List: contact dev-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "POI Developers List" Delivered-To: mailing list dev@poi.apache.org Received: (qmail 23559 invoked by uid 99); 11 Sep 2011 13:25:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 11 Sep 2011 13:25:24 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.115] (HELO eir.zones.apache.org) (140.211.11.115) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 11 Sep 2011 13:25:22 +0000 Received: by eir.zones.apache.org (Postfix, from userid 80) id 1958B48F77; Sun, 11 Sep 2011 13:25:01 +0000 (UTC) From: bugzilla@apache.org To: dev@poi.apache.org Subject: DO NOT REPLY [Bug 51800] New: Text replacement is not proper for SlideShow Date: Sun, 11 Sep 2011 13:25:00 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: POI X-Bugzilla-Component: HSLF X-Bugzilla-Keywords: X-Bugzilla-Severity: major X-Bugzilla-Who: sanmoy@gmail.com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: dev@poi.apache.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: https://issues.apache.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org https://issues.apache.org/bugzilla/show_bug.cgi?id=51800 Bug #: 51800 Summary: Text replacement is not proper for SlideShow Product: POI Version: 3.8-dev Platform: PC OS/Version: All Status: NEW Severity: major Priority: P2 Component: HSLF AssignedTo: dev@poi.apache.org ReportedBy: sanmoy@gmail.com Classification: Unclassified Created attachment 27483 --> https://issues.apache.org/bugzilla/attachment.cgi?id=27483 input file I had written a code to replace text from a .ppt document import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.apache.poi.hslf.model.Slide; import org.apache.poi.hslf.model.TextRun; import org.apache.poi.hslf.usermodel.SlideShow; public class PPTHandler2 { public static void main(String[] args) throws IOException { InputStream inputStream = new FileInputStream("C:/simple.ppt"); OutputStream outputStream = new FileOutputStream("C:/simple_out.ppt"); SlideShow aSlideShow = new SlideShow(inputStream); Slide[] pptSlides = aSlideShow.getSlides(); for (Slide aSlide : pptSlides) { TextRun[] textRuns = aSlide.getTextRuns(); for (TextRun aTextRun : textRuns) { String inputText= aTextRun.getText(); aTextRun.setText(inputText+"added"); } } aSlideShow.write(outputStream); inputStream.close(); outputStream.close(); } } But the output file is corrupted after operation. Where as, if I use the same text, aTextRun.setText(inputText), output file is fine. -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org For additional commands, e-mail: dev-help@poi.apache.org