convertToSmartArt throws NullPointerException in 19.6


#1

I have upgraded from Aspose Slides (Java) 18.2 to 19.6 and observed that a simple file that use to work now throws NullPointerException.

We are trying to extract all the text in the presentation and in the past used convertToSmartArt() on any ILegacyDiagram shapes to ‘upgrade’ the object so that the new API’s would return the text in older shapes. Without using it we don’t get ‘test1’, ‘test2’, ‘test3’, ‘test4’ and ‘goal1’, ‘goal2’, ‘goal3’ from the shapes.

Please see attached sample code and test.ppt.
sample.zip (5.4 KB)

Regards
Nick


#2

@nuix,

I have observed your comments. A ticket with ID SLIDESJAVA-37701 has been created in our issue tracking system to investigate this issue in detail. This thread has been associated with the ticket so that we may share the notification with you once investigation will be completed.


#3

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


#4

Hi there,
We have tried aspose.slides-for-java-19.7. But unfortunately, we are still getting the same error (NullPointerException). Can you please look into it? (You should be able to use sample zip for verification.)
Please let me know if you need more details or information.

Thanks,
Nuix


#5

@nuix,

I suggest using convertToGroupShape() instead of convertToSmartArt().

public static void main(String args[]) throws IOException
{
Presentation presentation = new Presentation(“test.ppt”);
ISlideCollection slideCollection = presentation.getSlides();

for (int i = 0; i < slideCollection.size(); i++)
{
    upgradeLegacyDiagrams(slideCollection.get_Item(i));
}

}

public static void upgradeLegacyDiagrams(ISlide slide)
{
IShapeCollection shapes = slide.getShapes();

for (int j = 0; j < shapes.size(); ++j)
{
    IShape shape = shapes.get_Item(j);

    if (shape instanceof ILegacyDiagram)
    {
        ILegacyDiagram legacy = (ILegacyDiagram) shape;
        IGroupShape gShape = legacy.convertToGroupShape();
        IShapeCollection shapeCollections = gShape.getShapes();
        for(IShape iShape : shapeCollections)
        {
            if (iShape instanceof AutoShape)
            {
                    if(((AutoShape)iShape).getTextFrame().getText() != null &&
                            !((AutoShape)iShape).getTextFrame().getText().equals(""))
                    System.out.println(((AutoShape)iShape).getTextFrame().getText());
            }
        }
    }
}

}