Hello,
I am writing to you about the problem we encountered in working with MSO PowerPoint document using the Aspose Slides for Java library (v23.2.0). We are using Ubuntu 22.04 LTS and OpenJDK 11.0.13.
When trying to access the effective property of portion in the attached presentation after presetting its values, the NullPointerException is raised (Cannot invoke “com.aspose.slides.ParagraphCollection.kg()” because the return value of “com.aspose.slides.Paragraph.z6()” is null).
In the attachment below, you can find the ZIP file with test code and source PPTX file.
Best regards!
Aleksandar
Test code and file (2997).zip (28.4 KB)
@zpredojevic,
I reproduced the problem with fetching effective values from the portion format.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): SLIDESJAVA-39140
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@zpredojevic,
Our developers have investigated the case. Please try using the following code snippet:
Presentation presentation = new Presentation(folderPath + "presentation.pptx");
try {
for (ISlide slide : presentation.getSlides()) {
for (int i = 0; i < slide.getShapes().size(); i++) {
IShape iShape = slide.getShapes().get_Item(i);
ISmartArt smartArt = (ISmartArt) iShape;
ISmartArtNodeCollection smartArtNodes = smartArt.getAllNodes();
for (int j =0; j < smartArtNodes.size(); j++) {
ISmartArtNode smartArtNode = smartArtNodes.get_Item(j);
for (ISmartArtShape smartArtShape : smartArtNode.getShapes())
{
ITextFrame textFrame = smartArtShape.getTextFrame();
if (textFrame != null)
{
IParagraphCollection paragraphs = textFrame.getParagraphs();
for (int k = 0; k < paragraphs.getCount(); k++) {
IParagraph paragraph = paragraphs.get_Item(k);
IPortionCollection portions = paragraph.getPortions();
for (int l = 0; l < portions.getCount(); l++) {
IPortion portion = portions.get_Item(l);
// presetting portion format font height
portion.getPortionFormat().setFontHeight(portion.getPortionFormat().getFontHeight());
// fetching portion effective value
portion.getPortionFormat().getEffective();
}
}
}
}
}
}
}
} finally {
if (presentation != null) {
presentation.dispose();
}
}