Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Thu May 05, 2016 6:35 pm

I want to read a text from each page and check if it exists in that page. If the text is there then I need to remove the page and save it. I could not find a way to read each page using spire.doc rather only sections are available. I have many pages within a section and need a way to read content page by page.

aswin1987
 
Posts: 2
Joined: Thu May 05, 2016 6:32 pm

Fri May 06, 2016 3:51 am

Hello,

Sorry that our product can not meet the requirement removing a page from a section containing many pages. Because Doc is a stream file. Regarding the way to read a text from each page, please try the below solution.
Code: Select all
            //Create Document 
            Document document = new Document();
            document.LoadFromFile(@"F:\test.docx");
            TextSelection[] text = document.FindAllString("word", 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");

If there is any problem, welcome to get it back to us.

Sincerely,
Caroline
E-iceblue support team
User avatar

caroline.zhang
 
Posts: 291
Joined: Mon Mar 07, 2016 9:22 am

Fri May 06, 2016 7:24 pm

Sure Thanks!!

aswin1987
 
Posts: 2
Joined: Thu May 05, 2016 6:32 pm

Return to Spire.Doc