Hi,
I created a new portion, set its font to Arial and replaced an old portion with the new one. When I open saved presentation in Powerpoint, it looks like the font name is represented with a number of Chinese or Japanese characters. Please take a look at the attached screenshot.
Here’s the code I used:
String path = “ForTranslation.pptx”;
Presentation presentation = new Presentation(new FileInputStream(path));
ISlide slide = presentation.getSlides().get_Item(0);
IAutoShape shape = (IAutoShape) slide.getShapes().get_Item(1);
IParagraph paragraph = shape.getTextFrame().getParagraphs().get_Item(0);
IPortionCollection portionCollection = paragraph.getPortions();
IPortion newPortion = new Portion(“Translated text”);
newPortion.getPortionFormat().setLatinFont(new FontData(“Arial”));
portionCollection.removeAt(0);
portionCollection.insert(0, newPortion);
presentation.save(“ForTranslation-result.pptx”, SaveFormat.Pptx);
Can you check this?
Also, can you tell me what’s the difference between:
portion.createPortionFormatEffective().getLatinFont();
and
portion.getPortionFormat().getLatinFont();
Thanks,
Zeljko