Click here to Skip to main content
15,896,118 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
I am just about to pull my last hairs out. Does anyone know of how to create a function or some line or two of code that actually searches ALL text within a PDF or DOC? I have been playing around with all sorts of ideas but have never came across this one. I do not want to search the title, I need to search the actual text in the body of these two file types. I hope this makes sense?
Posted

1 solution

You can't do it in one function!

I can't help you in ASP.NET, but i can explain it in VB.NET ;)

To search MS Word's documents use build-in in MS Word application Find.Execute[^] method.
There are two methods to create MS Word application:
1) using Interop.Services
2) using OLE.

In the first case you need to add reference to Interop.Serices and write code like this:
VB
Dim wrdApp = New Word.Application

The advantage is: client's computers does not need MS Word application.

In the second case you need to create MS Word application like this:
VB
Dim wrdApp As Object = Nothing
wrdApp = CreateObject("Word.Application")

Now you have access to all methods and functions in MS Word ;)
The disadvantage of this approach is the requirement to install MS Word on the client's computers.

Read more about: early/late bound[^].
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900