We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Wrong font name

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

Hi Zeljko,

I have tested the code sample on my end and have generated the presentation by setting the font to Arial. The generated presentation is also shared for your kind reference. You can observe that there is no issue in generated presentation while displaying the font name. I have used Aspose.Slides for Java 15.9.0 on my end. Can you please use the specified version and if there is still an issue then please share the source presentation, generated presentation and other environment details that I may use on my end to reproduce the issue.

Many Thanks,