If You Comment on a Picture, the Shape Property Is Null and Position Is Always 0,0

private List<IModernComment> FindSlideComments(ISlide slide, IShape shape)
{
    var comments = new List<IModernComment>();
    foreach (var commentAuthor in slide.Presentation.CommentAuthors)
    {
        foreach (IModernComment comment in commentAuthor.Comments.Cast<IModernComment>())
        {
            if (comment.Status != ModernCommentStatus.Active) continue;

            if (comment.Slide.SlideId != slide.SlideId) continue;

            if (comment.Shape != null && comment.Shape.OfficeInteropShapeId == shape.OfficeInteropShapeId)
            {
                comments.Add(comment);
                continue;
            }

            if (comment.Shape == null && new RectangleF(shape.X, shape.Y, shape.Width, shape.Height).Contains(comment.Position))
            {
                comments.Add(comment);
                continue;
            }
        }
    }
    return comments;
}

If you comment on a picture, comment.Shape is null; comment.Position is always 0,0.

The official website’s example also cannot output right Position.

// Instantiates the Presentation class
using (Presentation presentation = new Presentation("Comments1.pptx"))
{
	// Iterate CommentAuthors
    foreach (var commentAuthor in presentation.CommentAuthors)
    {
        var author = (CommentAuthor) commentAuthor;
		// Iterate Comments
        foreach (var comment1 in author.Comments)
        {
            var comment = (Comment) comment1;
            Console.WriteLine("ISlide :" + comment.Slide.SlideNumber + " has comment: " + comment.Text + " with Author: " + comment.Author.Name + " posted on Position :" + comment.Position + "\n");
        }
    }
}

@heiyitian365,
Thank you for contacting free support.

We need more details to investigate the case. Please share the following files and information:

  • sample presentation file (you can zip it and upload an archive with the file here)
  • Aspose.Slides version you used

bugdemo.pptx.zip (6.9 MB)

Include=“Aspose.Slides.Net” Version=“24.10.0”

@heiyitian365,
Thank you for the details. I’ve reproduced the problem with the Shape and Position properties of the comments in the PowerPoint presentation you provided.

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): SLIDESNET-44753

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.