public void ParseCore() { var list = new List <(string replacedString, string replacingString)>(); using (WordprocessingDocument document = WordprocessingDocument.Open(this.ResultWordFileFullName, true)) { this.SimpleLabelReplacement(this.Result, document); this.SetStatistcisTable(this.Result, document); this.SetTestingTools(this.Result, document); //再处理一下finnaly notes. var text = document.MainDocumentPart.Document.Body.Descendants <Text>().Where(t => t.Text == "{{finnallynotes}}").FirstOrDefault(); if (text != null) { var run = (Run)text.Parent; var paragraph = (Paragraph)run.Parent; var paragraphParent = paragraph.Parent; var addedparagraph = paragraph; for (var i = 0; i < this.Result.FinallyNotes.Count; i++) { this.Result.FinallyNotes[i] = (i + 1).ToString() + "." + this.Result.FinallyNotes[i]; } for (var i = 0; i < this.Result.FinallyNotes.Count; i++) { if (i > 0) { paragraph = (Paragraph)paragraph.Clone(); } paragraph.Elements <Run>().ToList()[0].Elements <Text>().ToList()[0].Text = this.Result.FinallyNotes[i]; if (i > 0) { paragraphParent.InsertAfter(paragraph, addedparagraph); } addedparagraph = paragraph; } } this.Result.FinallyNotes.ForEach(fullString => { document.SetNumberStyle(fullString); }); document.Save(); } }