Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: selection Word insert
Im seeking to make application that archiving word documents
I face a problem in searching the content of those files on aspecefic text , so i decieded to insert the files in database , where each page will be arecord in atable have the name of the decument.
i can read from the document file, but in need to select each page and insert them in a table.
 Dim word As New Microsoft.Office.Interop.Word.Application
        Dim doc As Microsoft.Office.Interop.Word.Document
 
        Try
            doc = word.Documents.Open("C:\Users\Public\Documents\Search Engine Optimization.doc")
           
            ' word.WindowState = word.WdWindowState.wdWindowStateNormal
            '  word.Visible = True

            doc.ActiveWindow.Selection.SetRange(0, 2060)
 
            doc.ActiveWindow.Selection.Copy()
 
            Dim data As DataObject
            data = Clipboard.GetDataObject()
            RichTextBox1.Text = data.GetData(DataFormats.Text).ToString()
            ' doc.Range.InsertAfter("Text Added at " & TimeOfDay.ToShortDateString)
        Catch ex As COMException
            MessageBox.Show("Error accessing Word document.")
        End Try
i used this code to read , i need a help for select each page recursevily!
Or Code for searching multible files contents?
Posted 26-Feb-12 23:20pm
Comments
ryanb31 at 27-Feb-12 8:22am
   
Refer to http://ryandev.com/how-to-find-and-replace-within-multiple-microsoft-office-word-documents/ on how to search through multiple files.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 277
1 Maciej Los 230
2 BillWoodruff 205
3 DamithSL 165
4 Sergey Alexandrovich Kryukov 155
0 OriginalGriff 5,130
1 DamithSL 4,157
2 Maciej Los 3,650
3 Kornfeld Eliyahu Peter 3,460
4 Sergey Alexandrovich Kryukov 2,811


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 27 Feb 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100