public static void ReadWordDocRequirements()

in traceabilitytool/reportgenerator.cs [249:269]


        public static void ReadWordDocRequirements(string filePath, ref Dictionary<string, string> reqLookup)
        {
            WordprocessingDocument wordprocessingDocument = WordprocessingDocument.Open(filePath, false);
            Body body = wordprocessingDocument.MainDocumentPart.Document.Body;

            // Accept deletions in tracked changes (revisions)
            List<OpenXmlElement> deletions = body.Descendants<Deleted>().Cast<OpenXmlElement>().ToList();
            deletions.AddRange(body.Descendants<DeletedRun>().Cast<OpenXmlElement>().ToList());
            deletions.AddRange(body.Descendants<DeletedMathControl>().Cast<OpenXmlElement>().ToList());
            foreach (OpenXmlElement deletion in deletions)
            {
                deletion.Remove();
            }

            string text = body.InnerText;

            wordprocessingDocument.Close();
            string pattern = @"SRS_[A-Z_\d]+_\d{2}_\d{3}";

            ExtractRequirements(filePath, pattern, text, ref reqLookup);
        }