Is there a method for detecting comments in PowerPoint files?

Is there a method for detecting comments in PowerPoint files (PPT and PPTX) using Aspose?

Thank you,

Kim

Hi Kim,


I am assuming that by slide comments you mean slide notes. Aspose.Slides for .NET allows you to access slide notes in both PPT and PPTX. Please follow this link for accessing PPTX comments and this link for accessing PPT slide notes.

Many Thanks,

Hi Mudassir,

We are actually looking to detect annotation comments in PPT files, not slide notes. Is that something that is supported?

Thank you,

Kim

Hi Kim,


I like to share that Aspose.Slides offers slide comments for both PPT and PPTX. For your kind reference, I have shared the sample project. Hopefully, it will serve the purpose for you. Please share with us, if I may help you further in this regard.

Many Thanks,

Hi Mudassir,

Thank you for sharing the sample project with us however this appears to show how to add comments to a PPT or PPTX. We're trying to detect if comments already exist in a PPT or PPTX.


Best regards,

Kim

Hi Kim,


Please use the following code for your convenience.

public static void IdentifyPptComments()
{
String path = @"…";

Presentation pres = new Presentation(path + “Comments.ppt”);

int i=1;
foreach(Slide slide in pres.Slides)
{
foreach(Comment comment in slide.SlideComments)
{
Console.WriteLine(“Slide :”+i.ToString()+" has comment: “+comment.Text+” with Author: “+comment.Author+ " posted on time :”+comment.CreatedTime+"\n");
i++;
}
}

}


public static void IdentifyPptxComments()
{
String path = @"…";

PresentationEx pres = new PresentationEx(path + “Comments.pptx”);

int i = 1;
foreach (CommentAuthorEx author in pres.CommentAuthors)
{
foreach (CommentEx comment in author.Comments)
{

Console.WriteLine(“Slide :” + comment.Slide.SlideNumber+ " has comment: " + comment.Text + " with Author: " + comment.Author + " posted on time :" + comment.CreatedTime + “\n”);

}
}
}

Many Thanks,

Thank you. I will share this with my developer.

Best regards,

Kim

slide.SlideComments is not available in the latest version of the lib. Can you give me a sample using latest version on how to find out the comments added to the slides in the ppt/pptx.

@pradeepdone,

I have observed your requirements and suggest you to please visit this documentation link to serve the purpose on your end. I hope the shared information will be helpful.

Got it. Its working now thank you.

And how do we get the same feature in Excel. I mean how to detect the comments from the excel

@pradeepdone,

See the sample code on how to get comments in an Excel worksheet for your reference:
e.g
Sample code:

 Workbook wb = new Workbook("Book1.xlsx");

            //Retrieving comments from the first worksheet
            CommentCollection comments = wb.Worksheets[0].Comments;
            for (int i = 0; i < comments.Count; i++)
            {
                Comment comment = comments[i];
                string text = comment.Note;
                string name = comment.CommentShape.Name;
}

Also, see the document for your further reference.

Hope, this helps a bit.

Sorry one last thing need the same feature word document as well. I mean how to detect the comments from the .doc file.

@pradeepdone,

Thanks for your inquiry. Please check the following code example and read the following article. Hope this helps you.
Working with Comments

Document doc = new Document(MyDir + "in.docx");
foreach (Comment comment in doc.GetChildNodes(NodeType.Comment, true))
{
    Console.WriteLine(comment.ToString(SaveFormat.Text));
}