Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 5th, 2006, 02:09 PM
Authorized User
 
Join Date: Jun 2003
Location: rawalpindi, panjab, Pakistan.
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to arshad mahmood
Default How to count lines in ASP

Dear All

I need ASP code for counting lines in MS word file.
Can any one help me.

Regards.



arshad mahmood
__________________
arshad mahmood
  #2 (permalink)  
Old June 6th, 2006, 06:35 AM
Authorized User
 
Join Date: Feb 2006
Location: Verona, Italy, Italy.
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

try this code !

<%
'Creazione dell'istanza FSO.
Set fsoMyFile = CreateObject("Scripting.FileSystemObject")

'Apertura del file, in lettura dati (1).
Set tsTextStream = fsoMyFile.OpenTextFile(Server.MapPath("file.doc"), 1)
conta = 0
do while not tsTextStream.AtEndOfStream
tsTextStream.ReadLine
conta = conta + 1
Loop
tsTextStream.Close
%>

The number is: <%=conta%>


Steweb




Visit my web site !
www.steweb.net
  #3 (permalink)  
Old June 6th, 2006, 03:11 PM
Authorized User
 
Join Date: Jun 2003
Location: rawalpindi, panjab, Pakistan.
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to arshad mahmood
Default

Dear steweb
textstream object works properly with .txt files only.
But this dose not works with .doc files.

Any way thank you.

If you have any other soloution i am waiting.

Thanks

arshad mahmood
  #4 (permalink)  
Old June 7th, 2006, 09:56 AM
Authorized User
 
Join Date: Feb 2006
Location: Verona, Italy, Italy.
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes ! sorry ..is not .rtf file !

Do you have Word.Application object ?

search in google..




Visit my web site !
www.steweb.net


Similar Threads
Thread Thread Starter Forum Replies Last Post
to count amount of lines in string glaudsonsilva C# 1 July 19th, 2007 03:10 PM
Need to Count number of lines in a file lawsoncobol Access VBA 2 July 19th, 2007 04:28 AM
how to count lines in word file arshad mahmood VB How-To 2 June 7th, 2006 09:40 PM
Datagrid scroll count (Lines) VB.NET 2003 peterasimpson VB How-To 1 November 24th, 2005 12:33 AM
Count the number of output lines joyces XSLT 7 July 6th, 2005 11:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.