I am passing in documents one at a time and extracting the title from the document. The code is repeatedly extracting the title from only from the first document and the other title’s from the second and third document are still pulling the title from the first document. I have been working on this code for 2 days. Any help would be greatly appreciated. My code is below:
Document doc = new Document(strDocFilePath + strFileName);
doc.UpdateListLabels();
Paragraph para = (Paragraph)doc.FirstSection.Body.GetChild(NodeType.Paragraph, 1, true);
foreach (Paragraph paragraph in doc.GetChildNodes(NodeType.Paragraph, true))
{
if (paragraph.IsListItem && paragraph.ListLabel.LabelString.Contains("WORK ITEM 1:"))
{
strTitle = paragraph.ToString(SaveFormat.Text);
strTitle = strTitle.Substring(12).TrimStart();
}
}
The title for the first document gets extracted, but all other documents have only the first documents extracted title.