Hi,
Attached file have a table and when I iterate throught it and change the text, after this table borders are no. I attach the file(table.ppt) and changed file(no-borders-table.ppt). Can you explain me what happened please?
Following code is used for this:
public void tabela() throws Exception {
String path = “path/table.ppt”;
Presentation presentation = new Presentation(path);
iterateShapes(presentation.getSlides().get(0).getShapes());
presentation.save(“path/no-border-table.ppt”,
SaveFormat.PPT);
}
private void iterateShapes(Shapes shapes) {
for (int i = 0; i < shapes.size(); i++) {
Shape shape = shapes.get(i);
if (shape instanceof GroupShape) {
GroupShape groupShape = (GroupShape) shape;
iterateShapes(groupShape.getShapes());
continue;
}
if (shape instanceof TextFrame) {
TextFrame textFrame = (TextFrame) shape;
Paragraphs paragraphs = textFrame.getParagraphs();
iterateParagraphs(paragraphs);
continue;
}
if (shape.getTextFrame() != null) {
TextFrame textFrame = shape.getTextFrame();
Paragraphs paragraphs = textFrame.getParagraphs();
iterateParagraphs(paragraphs);
}
}
}
private void iterateParagraphs(Paragraphs paragraphs) {
for (int i = 0; i < paragraphs.getCount(); i++) {
Paragraph paragraph = paragraphs.get(i);
paragraph.setText(“a”);
}
}
Thanks,
Bojan