Hi team,
Currently I'm using the library in java. I need to change the font size of all the content in a slide for the existing powerpoint. Can you please suggest me ?
Thanks,
Mohan.
//Load a PPT document
Presentation presentation = new Presentation();
presentation.loadFromFile("test.pptx");
for (Object o : presentation.getSlides().get(0).getShapes()) {
if (o instanceof IAutoShape) {
IAutoShape shape = (IAutoShape) o;
for (Object paraObj : shape.getTextFrame().getParagraphs()) {
ParagraphEx para = (ParagraphEx) paraObj;
int max = para.getTextRanges().getCount();
for (int i = 0; i < max; i++) {
para.getTextRanges().get(i).setFontHeight(14);
}
}
}
if (o instanceof ISmartArt) {
ISmartArt shape = (ISmartArt) o;
for (Object nodeObj : shape.getNodes()) {
ISmartArtNode node = (ISmartArtNode) nodeObj;
for (Object paraObj : node.getTextFrame().getParagraphs()) {
ParagraphEx para = (ParagraphEx) paraObj;
int max = para.getTextRanges().getCount();
for (int i = 0; i < max; i++) {
para.getTextRanges().get(i).setFontHeight(14);
}
}
}
}
}
presentation.saveToFile("out.pptx", FileFormat.PPTX_2013);
}