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.