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

Free Support Forum - aspose.com

Determining font of text


Could you please help with one issue?
how font applied to text can be recognized and determined among others?
There are FontEntity and Presentation (*.ppt) (aspose.slides-8.6.0)
We want to see all text of this font. How to do it?

FontEntity fntEnt
int i0 = fntEnt.getFontId();
String name = fntEnt.getFontName();

ITextBox[] textBoxesPPT = SlideUtil.getAllTextBoxes(pres, true);

StringBuilder allText = new StringBuilder();
// Loop through the Array of TextFrames
for (int i = 0; i < textBoxesPPT.length; i++) {

// Loop through paragraphs in current ITextFrame
for (Paragraph para : textBoxesPPT[i].getParagraphs()) {

// Loop through portions in the current IParagraph
for (Portion port : para.getPortions()) {

if (???) {
else {

I’ve read https://docs.aspose.com/slides/java/manage-fonts/
but can’t apply it because neither Paragraph nor Portion has not method .getPortionFormat() or getFont(), only getFontIndex
Thank you in advance.

Hi there,

Thank you for your inquiry. Just to let you know our support team have a short break early this week but rest assured your issue will be look into as soon as they return.


Hi Akane,

Thank you for the details and sorry for the delay in response.

I am afraid, currently, the feature to get the font information of the portion is not available in Aspose.Slides for Java. A feature enhancement request has been registered in our issue tracking system with issue id: SLIDESJAVA-34592.

As per the documentation link mentioned by you, it is for Aspose.Slides for Java v14.x.x and getPortionFormat is available in the latest version. You will need to upgrade to the latest version to use with the above documentation link. However, it doesn’t return the font information and an issue has been registered (as mentioned above).

Thanks & Regards,

Thank you very much for tour reply.
(You made it clear for me)

Hi Akane,

I have received a feedback from the development team. In most cases a portion doesn’t have its own Font definition. It uses
the font defined in a paragraph or in master styles. The method
Portion.getPortionFormat().getLatinFont() returns the font defined
directly in portion format. For retrieving an inherited font it is
necessary to use Portion.createPortionFormatEffective().getLatinFont().

Please try the following sample code to get the font name from PPTX file.

//Instantiate a Presentation object that represents a PPTX file
Presentation pres = new Presentation(“d:\data\Ppttest.pptx”);

//Accessing a slide using its slide position
ISlide slide = pres.getSlides().get_Item(0);

//Accessing the first and second placeholder in the slide and typecasting it as AutoShape
ITextFrame tf1 = ((IAutoShape)slide.getShapes().get_Item(0)).getTextFrame();

//Accessing the first Paragraph
IParagraph para1 = tf1.getParagraphs().get_Item(0);

//Accessing the first portion
IPortion port1 = para1.getPortions().get_Item(0);

String fontname = port1.createPortionFormatEffective().getLatinFont().getFontName();

//Display Font Name

Please feel free to contact support in case you need any further assistance.

Thanks & Regards,

Thank you for your reply.
Could you please precise since which release this functionality is available?
Because, as I’ve noticed above:


I’ve read https://docs.aspose.com/slides/java/manage-fonts/
but can’t apply it because neither Paragraph nor Portion has not method .getPortionFormat() or getFont(), only getFontIndex

And there are no available interfaces or classes ISlides, ITextFrame… in com.aspose.slides, and “The method createPortionFormatEffective() is undefined for the type Portion”

Hi Akane,

The above solution works with Aspose.Slides for Java v14.7.0 and the latest version Aspose.Slides for Java v14.8.0. Please download and try it and in case you still face any issue, please do let us know.

Thanks & Regards,

The issues you have found earlier (filed as SLIDESJAVA-34592) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.