DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   VB.NET (http://www.daniweb.com/forums/forum58.html)
-   -   Line Count in MSword using vb.net (http://www.daniweb.com/forums/thread164732.html)

jaiprakash15 Dec 29th, 2008 7:06 am
Line Count in MSword using vb.net
 
Dear Friends,

Am new to vb.net environment. i need to display the number of lines in word file using vb.net..please can anyone help me with this. any code will be appreciated..

Thanks and Regards,
Jayaprakash

Alexpap Dec 30th, 2008 4:32 am
Re: Line Count in MSword using vb.net
 
you could use the streamreader.Readline() and you must declare a variable of value Integer. After declaration make a loop until the End Of File is reached, and for each line that read then plus 1 to the value of the counter.

Hope i helped,
Alex

sr = Streamreader
Example:
While (End of File is reached)
sr.Readline()
counter += 1
End While

jaiprakash15 Dec 30th, 2008 5:03 am
Re: Line Count in MSword using vb.net
 
Will this Work on MsWord..I need to Count The No of Pages and Line in a MsWord File

Comatose Dec 31st, 2008 1:44 am
Re: Line Count in MSword using vb.net
 
Hmmm...
dim objWord
dim myDoc
Set objWord = New Word.Application
Set myDoc = objWord.Documents.Add("filename")
msgbox myDoc.BuiltInDocumentProperties("NUMBER OF LINES").Value
If The Above Doesn't Work, It Might Be:
msgbox objWord.BuiltInDocumentProperties("NUMBER OF LINES").Value

jaiprakash15 Dec 31st, 2008 1:57 am
Re: Line Count in MSword using vb.net
 
Thanks for the Quick response..Will try this and reply you..


All times are GMT -4. The time now is 3:54 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC