Hi,
I have a .ppt file who have a Portion with “Century” font name. Now, when I set this Text “Drèw” and font Index in this Portion font name in saved .ppt file is ok but when I create new Portion and set this Text and set the same font Index, in saved file font for letter “è” is not the same, there is Calibri.
this is the code how you can to check this and you have attached file:
public void pptSetFont() throws Exception {
String path = “”;
Presentation presentation = new Presentation(path);
Slide slide = presentation.getSlideByPosition(1);
Shapes shapes = slide.getShapes();
Shape shape = shapes.get(0);
TextFrame frame = shape.getTextFrame();
Paragraphs paragraphs = frame.getParagraphs();
Paragraph paragraph = paragraphs.get(0);
Portions portions = paragraph.getPortions();
Portion portion = portions.get(0);
int fontIndex = portion.getFontIndex();
Portion newPortion = new Portion();
newPortion.setText(“Drèw”);
newPortion.setFontIndex(fontIndex);
portions.add(newPortion);
portion.setText(“Drèw”);
portion.setFontIndex(fontIndex);
presentation.save("", SaveFormat.PPT);
}
Thanks,
Bojan