Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / August 2007

Tip: Looking for answers? Try searching our database.

Read Word file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alberto - 29 Aug 2007 17:11 GMT
How can I read a word file from C#?
I need to process each word of the document for a work.

Thank you.
Arunkumar Keserla - 29 Aug 2007 19:16 GMT
Do you mean a MS Word document or a text document. If you want to read a
text document the following is the snippet, you could

       string path = @"c:\temp\temp.txt";

       // This text is added only once to the file.
       if (!File.Exists(path))
           throw new FileNotFoundException("File not found");

       // Open the file to read from to read line by line and storing it
in an array.
       string[] readText = File.ReadAllLines(path);
       foreach (string s in readText)
           Console.WriteLine(s);

       // Open the file to read from to read the entire contents into a
string
       string text = File.ReadAllText(path);
       Console.WriteLine(text);

-Arun

> How can I read a word file from C#?
> I need to process each word of the document for a work.
> Thank you.
Alberto - 29 Aug 2007 20:02 GMT
I mean a Word document.
Thank you
> Do you mean a MS Word document or a text document. If you want to read a
> text document the following is the snippet, you could
[quoted text clipped - 20 lines]
>> I need to process each word of the document for a work.
>> Thank you.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.