Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using general fields
Message
From
04/08/1999 04:06:47
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
03/08/1999 15:10:16
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00248424
Message ID:
00249607
Views:
17
>>So mainconcern is to save as text from embedded word doc.
>
>Thank you very much for your suggestions, but that's not it either. We don't want separate files, or we would use linking instead of embedding. We just need to find out how many lines of text have been typed in the field (so we can decide where to print it), something like the MEMLINES function for memos. What I have been looking for is a way to pass just the text portion of the embedded document to a function for evaluation, but maybe that just isn't possible.
>
>I've probably been going about it all wrong... what about this: Word keeps track of information like number of paragraphs, lines, characters, etc., under File Properties. Is there some way to return those statistics about the embedded document when the user is finished editing it?

Yes, you could get statistics. Check out the word command "ComputeStatistics". Syntax is :
expression.ComputeStatistics(Statistic, IncludeFootnotesAndEndnotes)
or
expression.ComputeStatistics(Statistic)

Syntax 1 expression is Document, 2 Range.
Statistic could be anyone of these : wdStatisticCharacters, wdStatisticCharactersWithSpaces, wdStatisticLines, wdStatisticPages, wdStatisticParagraphs, or wdStatisticWords.
IncludeFootnotesAndEndnotes is optional (logical).

This info correspond to "Tools\Word count" or "Files\Properties\Statistics" in menu.
* Word constants header file
#include "wdconst.h"
* Word constants header file - should be in files section
lcDocName = "c:\DocPath\Mydoc.doc"
oWordDocument=createobject("word.application")	&& Create word object
WITH oWordDocument
  .documents.open(lcDocName)
  WITH .ActiveDocument
    ? "Chars: ",.ComputeStatistics(wdStatisticCharacters)
    ? "Charswspaces: ",.ComputeStatistics(wdStatisticCharactersWithSpaces)
    ? "Lines: ",.ComputeStatistics(wdStatisticLines)
    ? "Pages: ",.ComputeStatistics(wdStatisticPages)
    ? "Paragraphs: ",.ComputeStatistics(wdStatisticParagraphs)
    ? "Words: ",.ComputeStatistics(wdStatisticWords)
  ENDWITH
  .Application.Quit(wdDoNotSaveChanges)
ENDWITH
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform