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: [email protected]
ReportedBy: [email protected]
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: [email protected]
For additional commands, e-mail: [email protected]