I'm trying to modifify the cell value of a table within a pptx file. Saving the file, the modification is not applied.
Here is the used code:
FileInputStream is = new FileInputStream("C:/Report_Template.pptx");
XMLSlideShow ppt = new XMLSlideShow(is);
is.close();
ppt.getPageSize();
for(XSLFSlide slide : ppt.getSlides()) {
for(XSLFShape shape : slide){
shape.getAnchor();
if (shape instanceof XSLFTable){
XSLFTable t = (XSLFTable) shape;
List<XSLFTableRow> r = t.getRows();
for (int i = 1; i < r.size(); i++) {
String text = r.get(i).getCells().get(1).getText();
if(text.contains("#ID")) {
r.get(i).getCells().get(1).setText("20131028152343");
}
}
}
}
}
FileOutputStream out = new FileOutputStream("C:/Report.pptx");
ppt.write(out);
out.close();
The file C:/Report.pptx does not contain the string "20131028152343" but "#ID". Could someone help me? Thanks in advanced, Meg