Hi Team,
I need to extract paragraph text, while extracting the text, comments also extracting. Any solution to ignore comment text please?
Hi Team,
I need to extract paragraph text, while extracting the text, comments also extracting. Any solution to ignore comment text please?
@kkumaranil485 You can use code like the following to ignore comments:
Document doc = new Document(@"C:\Temp\in.docx");
Paragraph para = doc.FirstSection.Body.FirstParagraph;
StringBuilder builder = new StringBuilder();
foreach (Node child in para.ChildNodes)
{
if (child.NodeType != NodeType.Comment)
builder.Append(child.ToString(SaveFormat.Text));
}
Console.WriteLine(builder.ToString());
Alternatively, you can implement DocumentVisitor and create your own TXT exporter.
The above solution works great. Thanks for the support.
Hi Team,
I need to ignore comments while retrieving data from StructuredDocumentTag. Is there any solution to this?
While if StructuredDocumentTag is a standard paragraph able to add the above condition, but when the tag is in Table unable to ignore comments.
@kkumaranil485 Could you please attach your input document and expected output? We will check the issue and provide you more information.