I've tested with Open Office, it can read the file... tested with Earlier
version Office office (2003 I think) and it does not work. Have attached a
test spreadsheet.. and here's the code to reproduce the problem...
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.hslf.HSLFSlideShow;
import org.apache.poi.hslf.model.Slide;
import org.apache.poi.hslf.model.TextRun;
import org.apache.poi.hslf.usermodel.SlideShow;
public class App {
public static void main(String[] args) {
try {
SlideShow ppt = new SlideShow(new
HSLFSlideShow("./src/main/resources/test.ppt"));
Slide[] slides = ppt.getSlides();
for (int i = 0; i < slides.length; i++) {
TextRun[] text = slides[i].getTextRuns();
for (int j = 0; j < text.length; j++) {
if (text[j].getText().contains("[SYSDATE]")) {
text[j].setText("REPLACED_DATE");
System.out.println("replaced date!" +
text[j].getText());
}
}
}
writeFile(ppt);
} catch (Exception e) {
System.out.println("Problem with slide show " + e.getMessage());
}
}
private static void writeFile(SlideShow slideshow) throws
FileNotFoundException, IOException {
FileOutputStream fos = null;
try {
File outputFile = new File("output.ppt");
fos = new FileOutputStream(outputFile);
slideshow.write(fos);
} finally {
if (fos != null) {
fos.close();
fos = null;
}
}
}
}
--
View this message in context:
http://www.nabble.com/Powerpoint%3A-modifying-text-causes-error%3A-Powerpoint-can%27t-read-this-text.-tp17130113p17364267.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]