473,387 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

c# searching .doc file for keywords

Hi everyone,
here's what I need to do...
I'm working on a windows application with c#
I have a table with a list of keywords.
The user will be selecting a word document from his computer.
Once the document has been selected, I want to search the document for the keywords I have in another table.
Once I find a key word, I want to add it to a list and start looking for the next keyword.
But if I don't find the keyword till the end of the page, I want to look for the next one without making further changes to the list.

I need to find a way to go through the .doc file or .txt file and search them for these keywords...

thanks in advance,
ditti
Oct 24 '07 #1
3 2689
nateraaaa
663 Expert 512MB
Have you looked into the StreamReader object? I think this would help you accomplish what you want to do.

Nathan
Oct 25 '07 #2
Plater
7,872 Expert 4TB
A txt filA plain text file will be simple to search through, however a .Doc file is normally filled with special characters denoting formatting, some of which could possibly be splitting up your words.
The RichTextBox *might* be able to help you with it, but I think it only does rtf and not outright .doc files.
Oct 25 '07 #3
thanks, I'll try looking into streamreader,
a little code would be helpful though

Also is there anyway, I can convert a doc file into a text file?
When I try to access it, it takes too long, that kind of lag would not really be acceptable.

so here's what I'm thinking of doing then
1) get path of word file required.
2) copy contents as plain text to a .txt file
3) loop though the text file for every keyword in the database.
4) store keywords found in a string

I got the first part done, I can get the user to browse the machine for the word file, so I can get the file and pick up the path

I need help with the other parts, I'm still searching the web for that though.
Oct 25 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Fuzzyman | last post by:
There have been a couple of config file 'systems' announced recently, that focus on building more powerful and complex configuration files. ConfigObj is a module to enable you to much more *simply*...
0
by: Chris Chandler | last post by:
Hello I am developing a web application that uses full text searching quite extensively. This is ideal where I am searching a large number of large varchar fields for a set of key words. My...
3
by: sal achhala | last post by:
I'm working with java and XML documents in order to search for keywords in a given element name, eg element name 'author' == "jo blogs". The problem is the XML documents are downloaded (this...
3
by: Antoine Junod | last post by:
Hello, I definitely have a problem to build a clean data structure. I would be very happy if some of you could help me as well as in the past. Here is my problem: -> I have a list of...
5
by: justobservant | last post by:
When more than one keyword is typed into a search-query, most of the search-results displayed indicate specified keywords scattered throughout an entire website of content i.e., this is shown as...
0
by: daveleominster | last post by:
I am trying to read in a XML file into to vb.net say I have a text box and I am searching for a command "Aname" I enter the text and push the button, I want my syntax info and summary info to...
11
by: jonathan184 | last post by:
script to search for keywords in files in a dir Basically the script consists of a file with part numbers I got a dir with files I want to search the files line by line and if a line has the...
5
by: beemomo | last post by:
Hi, I am attempting to develop a library system in Ms Access 07 but I face problem with the search function of the system. The search function is just like a search engine, the user type in a word...
9
by: drhowarddrfine | last post by:
I don't want to use a db manager, like mysql, for such a small database but I'm finding this trickier than I thought and hope someone can provide some guidance. I have a restaurant menu with...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.