Skip to content

Commit 81cdf46

Browse files
author
Konduru Keerthi Konduru Ravichandra Raju
committed
Extract comments
1 parent 70a87b6 commit 81cdf46

File tree

1 file changed

+8
-17
lines changed
  • Comments/Extract-comments/.NET/Extract-comments

1 file changed

+8
-17
lines changed
Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,17 @@
11
using Syncfusion.DocIO.DLS;
22
using Syncfusion.DocIO;
33

4-
namespace Extract_comments
4+
//Open an existing document
5+
using (FileStream inputStream = new FileStream(@"../../../Data/Template.docx", FileMode.Open, FileAccess.Read))
56
{
6-
internal class Program
7+
using (WordDocument document = new WordDocument(inputStream, FormatType.Docx))
78
{
8-
static void Main(string[] args)
9+
//Iterate through the comments in the Word document
10+
foreach (WComment comment in document.Comments)
911
{
10-
//Open an existing document
11-
using (FileStream inputStream = new FileStream(@"../../../Data/Template.docx", FileMode.Open, FileAccess.Read))
12-
{
13-
using (WordDocument document = new WordDocument(inputStream, FormatType.Docx))
14-
{
15-
//Iterate through the comments in the Word document
16-
foreach (WComment comment in document.Comments)
17-
{
18-
//Traverse each paragraph from the comment body items
19-
foreach (WParagraph paragraph in comment.TextBody.Paragraphs)
20-
Console.WriteLine(paragraph.Text);
21-
}
22-
}
23-
}
12+
//Traverse each paragraph from the comment body items
13+
foreach (WParagraph paragraph in comment.TextBody.Paragraphs)
14+
Console.WriteLine(paragraph.Text);
2415
}
2516
}
2617
}

0 commit comments

Comments
 (0)