For each bit of document do ?

M

Marc Hillman

How can I go through a Word document sequentially, by paragraph, field,
table, etc ? I'm looking for the construct Paragraph followed by Table
followed by Paragraph. I can iterate through the paragraphs collection, or
through the tables collection, but how do you iterate through all pieces in
order ?

Delete REMOVE from my e-mail address to reply direct.

_______________________________________
Marc Hillman, Melbourne, Australia
web: http://users.bigpond.net.au/mhillman/
 
J

Jezebel

There's no simple answer to that. The document comprises the collection of
StoryRanges, each of which comprises paragraphs, words, characters, and
tables; and tables in turn contain paragraphs and possibly more tables.
There is no 'elements' collection containing everything. What are you trying
to do?
 
M

Marc Hillman

I'm trying to check that certain elements appear in a certain order, for
instance that every table is preceded or followed immediately by text of
style "Caption". I feel I should be able to iterate through something and
hit a table and then a paragraph (and check its style).

It causes me to wonder, if I wanted to render a word document in some
strange way (eg I wanted to write my own HTML exporter) how could you do it?
I don't understand how I could find all the different pieces sequentially
and export them.

(Delete REMOVE from my e-mail to reply direct)
 
M

Marc Hillman

Thanks Cindy & Jay. Both approaches will help solve my problem. I'll
probably experiment with both to see which is more efficient for my type of
documents.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top