Find text in files

  • Thread starter Thread starter Magnus Blomberg
  • Start date Start date
M

Magnus Blomberg

Hello!
I am trying to write a small application that will work as a searchengine
for a filestructure. The hard issue is that I would like to search for
freetext in files.
Most of the files are Word documents at approx. 30kb, but some files could
be there that includes pictures etc. I know that Windows has an index
functionality. Could this be a feature to use. Are there any namespaces for
this?

I started to develop my application and collected the files fullname in a
table. Then I got stucked when I didn't find any 'find' or 'search' method
in FileStream for instance.

Could someone help me with, how this should be done with the best
performance.
Regards Magnus
 
Hi)

Imo you should add a reference on Microsoft Word object library and play
with it:).
You'll find it on the COM tab of Add Reference dialog.

Regards,
InK_
 
Thanks!
Tried to work with the Microsoft.Office.Tools.Word.Document but didn't
get how to load a existing document into it. What's the main code for
loading a specific document into an object?
Regards Magnus
 
Hi!
Thanks for your answer. I was trying to add the "Microsoft Office 11.0
Object Library" to my server, that doesn't have Office. It seemed like this
was necessary for the example in the link just wrote below.
I found that this library was located in the file mso.dll, but I couldn't
register it, either by using regsrv32.exe or by adding a reference inside my
dotnet project.
How to do it?
Regards Magnus
 
Hi)
mso.dll can have deep dependencies - so it could cause problem with
regestering.
So if you don't register dependencies before, it won't register dll.

Then, you know, for reading doc file you need word application installed on
your machine.
winword.exe is outproc com server. The sample loads word.
Word must find all the components it need to function properly.

Thus, you can intall winword on server or try to find out and register all
needed components.
The second solution for sure will take more time and can lead to limitations
or no result imo.
Will word work after those efforts? This question needs studying...

Regards, InK_
 
HI
The other solution:
You can also use RichTextBox control that loads file in RTF format, if it's
not in principle to have doc file(not rtf).

regards,
InK_
 
Thanks!
I will go for a solution where I search in text in all files, with separate
extensions and not to large files. Works rather well until I decide to
install Word at a server with DotNet.
Regards Magnus
 
Back
Top