/// <summary> /// Removes Comments, and Hidden Slides of PowerPoint file /// </summary> public static void RemoveHiddenData() { try { //ExStart:RemoveHiddenDataInPPT // initialize PptFormat PptFormat pptFormat = new PptFormat(Common.MapSourceFilePath(filePath)); // get hidden data PptInspectionResult hiddenData = pptFormat.InspectDocument(); // get comments PptComment[] comments = hiddenData.Comments; if (comments.Length > 0) { // remove all comments pptFormat.RemoveHiddenData(new PptInspectionOptions(PptInspectorOptionsEnum.Comments)); Console.WriteLine("Comments removed."); // and commit changes pptFormat.Save(); Console.WriteLine("Changes saved successfully!"); } else { Console.WriteLine("No comments found!"); } //ExEnd:RemoveHiddenDataInPPT } catch (Exception exp) { Console.WriteLine(exp.Message); } }
/// <summary> /// Gets Comments, and Hidden Slides of PowerPoint file /// </summary> public static void GetHiddenData() { try { //ExStart:GetHiddenDataInPPT // initialize PptFormat PptFormat pptFormat = new PptFormat(Common.MapSourceFilePath(filePath)); // get hidden data PptInspectionResult hiddenData = pptFormat.InspectDocument(); // get comments PptComment[] comments = hiddenData.Comments; // get slides PptSlide[] slides = hiddenData.HiddenSlides; foreach (PptComment comment in comments) { Console.WriteLine("Author: {0}, Slide: {1}", comment.Author, comment.SlideId); } //ExEnd:GetHiddenDataInPPT } catch (Exception exp) { Console.WriteLine(exp.Message); } }