class Program
{
static void Main(string[] args)
{
string fileName = "OpenXML.docx";
GetCommentsFromDocument(fileName);
}
public static void GetCommentsFromDocument(string fileName)
{
using (WordprocessingDocument wordDoc =
WordprocessingDocument.Open(fileName, false))
{
WordprocessingCommentsPart commentsPart =
wordDoc.MainDocumentPart.WordprocessingCommentsPart;
if (commentsPart != null && commentsPart.Comments != null)
{
foreach (Comment comment in commentsPart.Comments.Elements())
{
Console.WriteLine(comment.InnerText);
}
}
}
Console.ReadLine();
}
}