Remove Comments from a Word document


/ Published in: C#
Save to your folder(s)

This code snippet removes any comments from a word document. The comments can be something like [this screenshot](https://www.dropbox.com/s/hm4kpqnjlniqch0/comments-word-doc.png?dl=0)


Copy this code and paste it in your HTML
  1. /// <summary>
  2. /// Removes document comments of Doc file
  3. /// </summary>
  4. public static void RemoveComments()
  5. {
  6. try
  7. {
  8.  
  9. // initialize DocFormat
  10. DocFormat docFormat = new DocFormat(Common.MapSourceFilePath(filePath));
  11.  
  12. // remove comments
  13. docFormat.ClearComments();
  14.  
  15. // save file in destination folder
  16. docFormat.Save(Common.MapDestinationFilePath(filePath));
  17.  
  18. Console.WriteLine("File saved in destination folder.");
  19.  
  20.  
  21. }
  22. catch (Exception exp)
  23. {
  24. Console.WriteLine(exp.Message);
  25. }
  26. }

URL: https://github.com/groupdocs-metadata/GroupDocs.Metadata-for-.NET/blob/master/Examples/GroupDocs.Metadata.Examples.CSharp/Documents.cs#L313

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.