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

Free Support Forum - aspose.com

Exception"Null reference" while getting paragraph coordinates using Aspose.Slides for .NET

Hi,

I’m facing an issue with getting paragraph coordinates in Aspose.Slides (.net, v18.5, licensed).
My paragraphs are located inside of an autoshape, so I’m using currently GetRect() method to get coordinates (relative to the parent as I understood), on all slides everything looks to be working fine, except of one slide.
GetRest() is throwing NullReferenceException, but I don’t understand why

StackTrace:
“Object reference not set to an instance of an object.”
at Aspose.Slides. .(String , , , Boolean , Single& )
at Aspose.Slides. .(String , )
at Aspose.Slides. .(Paragraph )
at Aspose.Slides.Paragraph.GetRect()

What can cause this issue?
Please advise

Thank you

@LostAndFound,

I have observed your comments. Can you please try to use Aspose.Slides latest version 18.10 and if there is still an issue than please share source file along with sample code and enviroment details so that we may further investigate to help you out.

Hi @Adnan.Ahmad

I have tried with latest version. It is throwing same exception.
I went deeper into XML of that slide and found that for failing paragraph it has some additional styling which take no effect on UI, but are different from other paragraph. It may happen that slide creator is copying from some source those additional settings (margins, indentation and so on.)

In my example you can find it failing for paragraph with text “Fghfghgfh”, but for others which I added from scratch it is working.

The code to reproduce that is simple:

var placeholder = (AutoShape)slide.Shapes.FirstOrDefault(x => x is AutoShape && x.Name.Contains("Content Placeholder"));
foreach (var paragraph in placeholder.TextFrame.Paragraphs)
{
    var paragraphRect = paragraph.GetRect(); // will fail for last item

}

Sample file is attached
Main_test_example.zip (2.4 MB)

Thank you

9@LostAndFound,

I have worked with presentation file shared by you and have been able to observe the issue specified. An issue with ID SLIDESNET-40679 has been created 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 notified once the issue will be fixed.

1 Like

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