Reading any document chracter by character  
Author Message
Sachini





PostPosted: Visual C# Language, Reading any document chracter by character Top

Dear Sir,

We want to read a word character by character in any document(.txt,.doc etc.) using C#.Net programming language.

Can you please do this for us

Thankyou.




Visual C#18  
 
 
ahmedilyas





PostPosted: Visual C# Language, Reading any document chracter by character Top

well you can read character by character doing it this way, reading it line by line then go through each character:

using (StreamReader theReader = new StreamReader("filename.txt"))

{

while (theReader.EndOfStream == false)

{

string currentLine = theReader.ReadLine();

foreach(Char curChar in currentLine)

{

MessageBox.Show(curChar.ToString());

}

}

}

this will read each line and each character of that line.

for reading word documents, formatting of the document is different so you won't get much from it apart from maybe using the MS Word COM Interop approach (plenty examples here on the forms I believe) and reading the lines/paragraphs and going through each character, perhaps the same way as above.

Does this help