// Remove all the comments in the slides by a certain author. public static void DeleteCommentsByAuthorInPresentation(string fileName, string author) { if (String.IsNullOrEmpty(fileName) || String.IsNullOrEmpty(author)) { throw new ArgumentNullException("File name or author name is NULL!"); } //Instantiate a PresentationEx object that represents a PPTX file using (PresentationEx pres = new PresentationEx(fileName)) { CommentAuthorEx[] authors = pres.CommentAuthors.FindByName(author); CommentAuthorEx thisAuthor = authors[0]; for (int i = thisAuthor.Comments.Count - 1; i >= 0; i--) { thisAuthor.Comments.RemoveAt(i); } pres.Save(fileName, Aspose.Slides.Export.SaveFormat.Pptx); } }
static void Main(string[] args) { using (PresentationEx pres = new PresentationEx()) { //Adding Empty slide pres.Slides.AddEmptySlide(pres.LayoutSlides[0]); //Adding Autthor CommentAuthorEx author = pres.CommentAuthors.AddAuthor("Zeeshan", "MZ"); //Position of comments PointF point = new PointF(); point.X = 1; point.Y = 1; //Adding slide comment for an author on slide author.Comments.AddComment("Hello Zeeshan, this is slide comment", pres.Slides[0], point, DateTime.Now); pres.Write("Comments.pptx"); } }