Posted By

muhammadsabir on 06/13/16


Tagged

doc comments metadata DOCX


Versions (?)

Remove Comments from a Word document


 / Published in: C#
 

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

This code snippet removes any comments from a word document. The comments can be something like this screenshot

  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. }

Report this snippet  

You need to login to post a comment.