Free Support Forum - aspose.com

Getting "Null reference " Exception while using Shapes.Y property from Aspose.Slides

Hi.

I have a requirement to generate slides dynamically using Aspose.slides (14.2.0.0) from SharePoint data. Here I need to identify the end of the slide based on Shape Height and the content needs to be moved to new slide

I have used the below code block in my solution to check the shape height and based on condition i am moving the text to next slide.

Isssue:

But here I am getting "Null Reference" exception for "Shape.Y" property for few item from sharepoint list items .Also I have attached the exception screenshot. Can someone please guide me where it went wrong and help me in resolving this issue.

IShape Shape = slide.Shapes[1];
if (Shape.Placeholder != null)
{
if (Shape.Placeholder.Type == PlaceholderType.Body || Shape.Placeholder.Type == PlaceholderType.Object)
{
Aspose.Slides.ITextFrame Holder = ((Aspose.Slides.IAutoShape)Shape).TextFrame;
Holder.TextFrameFormat.AutofitType = TextAutofitType.Shape;
if (Shape.Y + Shape.Height > presentation.SlideSize.Size.Height - 40)
{
overflow = true;
} }
}

Hi.

I have a requirement to generate slides dynamically using Aspose.slides (14.2.0.0) from SharePoint data. Here I need to identify the end of the slide based on Shape Height and the content needs to be moved to new slide

I have used the below code block in my solution to check the shape height and based on condition i am moving the text to next slide.

Isssue:

But here I am getting "Null Reference" exception for "Shape.Y" property for few item from sharepoint list items .Also I have attached the exception screenshot. Can someone please guide me where it went wrong and help me in resolving this issue.

IShape Shape = slide.Shapes[1];
if (Shape.Placeholder != null)
{
if (Shape.Placeholder.Type == PlaceholderType.Body || Shape.Placeholder.Type == PlaceholderType.Object)
{
Aspose.Slides.ITextFrame Holder = ((Aspose.Slides.IAutoShape)Shape).TextFrame;
Holder.TextFrameFormat.AutofitType = TextAutofitType.Shape;
if (Shape.Y + Shape.Height > presentation.SlideSize.Size.Height - 40)
{
overflow = true;
} }
}

Hi Vimalraj,


Thank you for your interest in Aspose.Slides.

I have observed your comments and have observed that you have shared the same problem in another thread. We have responded to you over this link. I request you to please visit the respective thread for your kind reference.

If the issue persists, please let us know. We will be happy to assist you further.

Best Regards,