473,606 Members | 2,885 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

c# searching .doc file for keywords

2 New Member
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 2720
nateraaaa
663 Recognized Expert Contributor
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 Recognized Expert Expert
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
dittiman
2 New Member
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
3817
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* access config files. This is version 3, which is a big overhaul. It extends ConfigObj to reading config files with sections and various other simplifications. I find ConfigObj extremely easy to use and use it for reading config files and data...
0
1557
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 problem is that each user on the site has a number of keywords in the database (approx 200000 users) and when I add a new item with the large varchar field I need to match all users who's keywords are found within the varchar text.
3
1936
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 process is automated) from different websites thus the element names for author may differ! Is their a way of dealing with this, such as perhaps a standard adopted by, say educational websites to agree on element names ? Thanks very much
3
1410
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 keywords. -> I would like to link each keyword with a string. -> I should be able to access the string of a given keyword via that keyword.
5
2388
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 three bolded periods '...' in search-result listings. Additionally, most content is outdated; as many users need up-to-date content. Hence, filtering-through search-results becomes quite cumbersome. The newsgroup listings allow detailed...
0
1430
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 appear on the next form in a two separate list box. So I am thinking a loop and if statements are need. What do you suggestion for the vb code Next if the there is no commandname that match then it search for a keyword and then lists the commands...
11
2290
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 part number I want it to print that line to an outfile file. I did this script but it does not find matching products. I aded an else statement and it only prints the else statements alone when i commented out the else statements nothing prints tot...
5
3240
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 and the system will start looking for the documents which contain the correspondent keyword after the search button is clicked. I have a table name tblDOC which contains the following fields: , , , , , , , , Note: is a hyperlink field The...
9
1904
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 prices and other info in a small file. It's set up in a YAML-ish style, if you're familiar with that format. I'm just looking for some ideas on the best way to retrieve data based on a "keyword". What complicates things for me is that some of these...
0
8031
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7962
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8456
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8443
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8315
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6792
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5971
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3945
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
1309
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.