Spire.Doc如何根据指定的文本,找到文本所在的标签段落。求解?

解决方案 »

  1.   


                //Create Document
                Document document = new Document();
                document.LoadFromFile(@"E:\Work\Documents\WordDocuments\References.docx");            TextSelection[] text = document.FindAllString("forming", false, true);
                foreach (TextSelection seletion in text)
                {
                    seletion.GetAsOneRange().CharacterFormat.HighlightColor = Color.Yellow;
                }            document.SaveToFile("FindHighlight.docx", FileFormat.Docx);
                System.Diagnostics.Process.Start("FindHighlight.docx");
    上面的代码是寻找和设置寻找的背景色  
    你可以看下里面的属性 有没有段落。
         seletion.GetAsOneRange().CharacterFormat.HighlightColor = Color.Yellow;