I am using ASP.NET, C# version 2.0
My concern is that, when the user will close the document on the web
browser, my code will get the line-count through your control and save
in the DB.
Please help me to get line count of the opened document in the component
in the IE.
If possible please send me the sample code to get the line-count using
Javascript.
2 Responses to “Get the line counts from the Word Component”
Leave a Reply
You must be logged in to post a comment.
October 17th, 2008 at 8:09 am
You can use the VBA to get the line counts or total words in the open ms word document.
The follow is a vbscript to get the line count.
Set objWord = OA1.ActiveDocument
Set myRange = objWord.Range
Dim WordCount
WordCount = myRange.ComputeStatistics(1)
MsgBox WordCount & ” words”
About the ComputeStatistics method.
Returns a statistic based on the contents of the specified range.
Constant value:
wdStatisticCharacters 3
wdStatisticCharactersWithSpaces 5
wdStatisticFarEastCharacters 6
wdStatisticLines 1
wdStatisticPages 2
wdStatisticParagraphs 4
wdStatisticWords 0
November 6th, 2008 at 10:13 am
javascript:
document.OA1.Open( “c:\\2007-07-3121.02ChatLog.rtf”, “Word.Document”);
var objWord = document.OA1.ActiveDocument;
var objRange = objWord.Range();
var count = objRange.ComputeStatistics (0);
window.alert(count);