Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2006

Tip: Looking for answers? Try searching our database.

Inside Word Objects

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lauro - 26 Apr 2006 22:56 GMT
I'd like to know how Word keep tracks of all the objects used in a
document.
When a document with several paragraphs (or other objects)  is open,
Word populate the set Document.Paragraphs object with several
Paragraph objects and keep everything in memory or it does nothing at
all?

I mean, when I use, for example, Document.Paragraphs.Count,  does Word
read a value stored in memory or it parse the document looking for
Paragraph Marks? There are variables storing values or the workings
are done on the spot?

Thanks, Lauro
Tony Jollans - 26 Apr 2006 23:13 GMT
I don't entirely follow what you're asking but I think the answer is it
depends, As far as I know nothing is documented but Word keeps track of some
things and calculates others on demand but which and when is anybody's
guess. My guess is that Paragraphs.Count is stored.

--
Enjoy,
Tony

> I'd like to know how Word keep tracks of all the objects used in a
> document.
[quoted text clipped - 9 lines]
>
> Thanks, Lauro
Lauro - 27 Apr 2006 21:31 GMT
>I don't entirely follow what you're asking but I think the answer is it
>depends, As far as I know nothing is documented but Word keeps track of some
>things and calculates others on demand but which and when is anybody's
>guess. My guess is that Paragraphs.Count is stored.

I'm trying to guess how Microsoft implemented the Word Model Object
because I'm trying to design a small Model Object with the goal to
extend some Word Objects (like paragraph, Table, Rows or Row).

For instance I'd like to have a MyRows Collection; so every time I
call MyRows.Add, a new Row AND a new MyRow will be created.[ MyRow
will have some extra property and methods]. But how I can keep track
of the number (or position) of MyRows if the user will delete (or
move) the regular Row?
It is better I try to trap all the possible commands or more likely
just to rely on the regular Rows property?
How does Word keep track of the rows? It keep some variable in memory
or just count (when needed) the row marks "on the document"?
Mybe is better that I don't keep MyRoes in memory but just create them
when needed and rely on the Word row marks.

I hope that I made my idea clearer.

ciao lauro
Jezebel - 28 Apr 2006 10:05 GMT
I think you're going to be pushing sh*t uphill to make this work. As Tony
says, the short answer is "it depends". Most object properties are dynamic:
that is, they are determined on-the-fly when you ask for them. Consider the
properties of a Range -- there are literally hundreds, and a Range can be
anything; so clearly Word can't store all the properties of all possible
Ranges.

Your Rows object is problematic for other reasons, too. Try this: create a
table. Select two cells from different rows and merge them. Now check the
table's Rows property. Or this: Create a table with 3 rows and 4 columns.
Merge cells 1 and 2 in row 1, cells 2 and 3 in row 2, and cells 3 and 4 in
row 3. Align the column boundaries. Now, using VBA, work out how many
columns the table has: three or four?

>>I don't entirely follow what you're asking but I think the answer is it
>>depends, As far as I know nothing is documented but Word keeps track of
[quoted text clipped - 21 lines]
>
> ciao lauro
Lauro - 28 Apr 2006 16:00 GMT
>I think you're going to be pushing sh*t uphill to make this work. As Tony
>says, the short answer is "it depends". Most object properties are dynamic:
[quoted text clipped - 9 lines]
>row 3. Align the column boundaries. Now, using VBA, work out how many
>columns the table has: three or four?

I think you are perfectly rigth. I guess I'm going to rely on Word
objects and create my own object on-the- fly whenever I need them,
without trying to store everything.

Ciao LAuro
Jonathan West - 28 Apr 2006 13:20 GMT
> I'd like to know how Word keep tracks of all the objects used in a
> document.
[quoted text clipped - 7 lines]
> Paragraph Marks? There are variables storing values or the workings
> are done on the spot?

I think it varies from object to object, but i think that for the most part
it parses the document.

Therefore, when I'm writing code to analyse a document in some way, I'll
frequently cache unchanging values into variables so they can be read more
quickly.

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org 

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.