Font Name

Hi,


I need to extract text from presentation and also I need text format.
When I try to get font name in attached presentation I get wrong font name, You can see on attached .jpg which font see MS Office and which I get throw code. Pay attention on special characters, like line break in first line, I don’t get any font for them. Here is my test:

public void test() {

Presentation pptxPresentation = new Presentation(
“simple-test.ppt”);

// Get an Array of TextFrameEx objects from the first slide
ITextFrame[] textFramesSlideOne = SlideUtil
.getAllTextBoxes(pptxPresentation.getSlides().get_Item(0));

// Loop through the Array of TextFrames
for (int i = 0; i < textFramesSlideOne.length; i++)

// Loop through paragraphs in current TextFrame
for (IParagraph para : textFramesSlideOne[0].getParagraphs())

// Loop through portions in the current Paragraph
for (IPortion port : para.getPortions()) {
System.out.println(getFontName((Portion) port));
}
}

public String getFontName(Portion portion) {
String fontName = “Not Found”;
IPortionFormat portionFormat = portion.getPortionFormat();
if (portionFormat.getLatinFont() != null) {
fontName = portionFormat.getLatinFont().getFontName();
} else {
if (portionFormat.getEastAsianFont() != null) {
fontName = portionFormat.getEastAsianFont().getFontName();
} else {
if (portionFormat.getSymbolFont() != null) {
fontName = portionFormat.getSymbolFont().getFontName();

}

}
}
return fontName;
}

Am I doing something wrong or there is issue in Yours API?

Thanks
Best regards

Hi Djordje,


Thank you for your interest in Aspose.Slides.

I have observed your comments and worked with the presentation file shared by you. The code is giving the font name as “MS Pゴシック”. Are you getting the same font name on your side. I have also been able to observe the issue of missing font name for special characters. Please confirm if you are getting the same font name as shared by me so that I may proceed further to help you out.

Best Regards,

Hi,


yes I am getting same font as You.

Thanks

Hi Djordje,


I have been able to reproduce the issue. A ticket with ID SLIDESJAVA-35006 has been logged in our issue tracking system to further investigate and resolve the issue.This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

We are sorry for your inconvenience,

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


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

Hi,


I execute my test with this 15.8.0 aspose.slides version and I reproduced same issue.
Can you check on your end?

Thanks
Best regards

Hi Djordje,


I have observed your comments and like to request you to please try using following sample code on your end and then share your kind feedback with us.



Presentation pres = new Presentation(“D://simple-test.ppt”);
for (ISlide slide : pres.getSlides()) {
for (IShape shp : slide.getShapes())
for (IParagraph paragraph : ((IAutoShape) shp)
.getTextFrame().getParagraphs()) {
for (IPortion portion : paragraph.getPortions()) {
if ((portion.getText().length() != 0)) {
System.out.println("PTEXT: " + portion.getText());

IPortionFormatEffectiveData portionFormat = portion.createPortionFormatEffective();

System.out.println("FontHeight: " + portionFormat.getFontHeight());

if (portionFormat.getLatinFont() != null)
	System.out.println("FontNameLatin: "  + portionFormat.getLatinFont().getFontName());

if (portionFormat.getEastAsianFont() != null)
	System.out.println("FontNameEAsian: " + portionFormat.getEastAsianFont().getFontName());

if (portion.getPortionFormat().getSymbolFont() != null) {
	System.out.println("FontNameSymbol: " + portionFormat.getSymbolFont().getFontName());
	System.out.println("Symbol Found Here");
}

}



I hope this will be helpful. Please share if I may help you further in this regard.

Best Regards,