Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
List all styles and their properties of a Word document
Message
From
17/08/2007 15:29:30
Hans-Otto Lochmann
Dr. Lochmann Consulting Gmbh
Frankfurt, Germany
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01248197
Message ID:
01248871
Views:
21
Hi Sergey,

thank you for taking care of my question.

Well actually, I did know already, how to loop through the Styles collection, so that this would not be the problem basically. Styles has about 26 "properties" and 2 methods (if I count right). The real problem is, that some of these "properties" are pointers to objects, which not only multiply these properties, but also contain pointers to further object.

A simple example: one of the object pointers of Styles is called Font, which in itself has 37 properties and 3 collections, each of which also possesses further properties and further collections. For instance the collection Borders (oStyles.Font.Borders.xxx) has about 28 properties and contains a collection of 7 more objects, each of which has about 6 properties (all numbers have not been re-checked, so it could be some more or some less). There are two more of the kind of collection, called .Duplicate and .Shading. .Duplicate has more than 35 properties and about 5 methods, and so on...

I think, now you got the point: I just wanted to know, whether there is someone, who already had invented that particular wheel.

Thank you for bothering, and if you should know someone, who ...

Have a nice weekend!
Hans


>Maybe I'm missing something but you can use Styles collection to loop through all the styles and retrieve their properties.Something like
>
>oDoc = oWord.ActiveDocument
>FOR EACH oStyle IN oDoc.Styles
>	IF NOT oStyle.Builtin
>		? oStyle.NameLocal
>		? oStyle.Font.Name, oStyle.Font.Size
>                ...
>	ENDIF
>ENDFOR
>
>
>>
>>I have a lengthy Word document, which has about 350 pages and about 190 different styles. I assume, that quite a few of the styles are at least very similar if not identical (besides their different names).
>>
>>Did anybody ever write some code, most preferably in VFP, which lists not only all styles by their name (that's easy), but also the values of all properties of all styles, preferably into an Excel sheet?
>>
>>Any idea is welcome!
>>
>>Hans
Previous
Reply
Map
View

Click here to load this message in the networking platform