Line Count in MSword using vb.net

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2008
Posts: 27
Reputation: jaiprakash15 is an unknown quantity at this point 
Solved Threads: 0
jaiprakash15 jaiprakash15 is offline Offline
Light Poster

Line Count in MSword using vb.net

 
0
  #1
Dec 29th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 36
Reputation: Alexpap is an unknown quantity at this point 
Solved Threads: 0
Alexpap Alexpap is offline Offline
Light Poster

Re: Line Count in MSword using vb.net

 
0
  #2
Dec 30th, 2008
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:
  1. While (End of File is reached)
  2. sr.Readline()
  3. counter += 1
  4. End While
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 27
Reputation: jaiprakash15 is an unknown quantity at this point 
Solved Threads: 0
jaiprakash15 jaiprakash15 is offline Offline
Light Poster

Re: Line Count in MSword using vb.net

 
0
  #3
Dec 30th, 2008
Will this Work on MsWord..I need to Count The No of Pages and Line in a MsWord File
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Line Count in MSword using vb.net

 
0
  #4
Dec 31st, 2008
Hmmm...
  1. dim objWord
  2. dim myDoc
  3. Set objWord = New Word.Application
  4. Set myDoc = objWord.Documents.Add("filename")
  5. msgbox myDoc.BuiltInDocumentProperties("NUMBER OF LINES").Value
If The Above Doesn't Work, It Might Be:
  1. msgbox objWord.BuiltInDocumentProperties("NUMBER OF LINES").Value
Last edited by Comatose; Dec 31st, 2008 at 1:45 am.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 27
Reputation: jaiprakash15 is an unknown quantity at this point 
Solved Threads: 0
jaiprakash15 jaiprakash15 is offline Offline
Light Poster

Re: Line Count in MSword using vb.net

 
0
  #5
Dec 31st, 2008
Thanks for the Quick response..Will try this and reply you..
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC