poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 51800] New: Text replacement is not proper for SlideShow
Date Sun, 11 Sep 2011 13:25:00 GMT
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


Mime
View raw message