コード例 #1
0
 //根据关键字位置集合返回所在段落集合
 private List<Paragraph> getParagraphCollectionByDocumentRangeCollection(List<DocumentRange> documentRangeCollection, Document searchDocument)
 {
     List<Paragraph> paragraphCollection = new List<Paragraph>();
     if (documentRangeCollection.Count != 0)
     {
         Paragraph par_Cur = searchDocument.GetParagraph(documentRangeCollection[0].Start);
         for (int i = 1; i < documentRangeCollection.Count; i++)
         {
             Paragraph par_Next = searchDocument.GetParagraph(documentRangeCollection[i].Start);
             if (!par_Cur.Equals(par_Next))
             {
                 paragraphCollection.Add(par_Cur);
                 par_Cur = par_Next;
             }
         }
     }
     return paragraphCollection;
 }