How can I walkthrough everything in a doc?

A

Abhishek

Hi!

Is there any way through which I can walkthrough everything in a doc.
I mean I start from the header of the first page, and go through everything
that is there in the doc including the images and the shapes in the order of
their appearance/position in the doc.
I need to read all this information and put it in the database.
Regards,
Abhishek
 
K

Klaus Linke

Abhishek said:
Hi!

Is there any way through which I can walkthrough everything in a doc.
I mean I start from the header of the first page, and go through
everything that is there in the doc including the images and the shapes in
the order of their appearance/position in the doc.
I need to read all this information and put it in the database.
Regards,
Abhishek


Hi Abhishek,

Word 2003? Why not just save as XML? Though with shapes, you get them where
they are anchored, not necessarily where they "appear".

Regards,
Klaus
 
A

Abhishek

Sorry for the late response
Ho w can I get the text throughthe XML
Can you please let me know the element tags that define the data in the XML

Thanks
Abhishek
 
K

Klaus Linke

Word 2003? Why not just save as XML? Though with shapes, you get them

Abhishek said:
Sorry for the late response
How can I get the text throughthe XML
Can you please let me know the element tags that define the data in the
XML

As I said, just save as XML, and then parse the XML (text) file any way you
want.
You can also get the XML for some story range of the current doc using
rng.XML for an open document.
What you do with that usually doesn't have much to do with the Word Object
Model any more.

You could set a reference to msxml (Microsoft XML) in the VBA editor, and
use that to walk the nodes:
Dim domdoc As New DOMDocument
Dim boolRet As Boolean
boolRet = domdoc.loadXML(ActiveDocument.Content.XML)

There is an office.xml newsgroup where you might get further help.

Microsoft has published a XSL transformation file for "converting" WordML to
HTML. You could use that as a model on how to strip the stuff from the XML
file that doesn't interest you, and keep other things.

The text is in w:t tags, other stuff in other tags. The schema for
WordprocessingML is documented... You should be able to find some files on
the format on MSDN, and I think David Thielen and others have devoted web
sites to the format that might be useful, too. Google for WordprocessingML
and/or WordML (a name that was used in the past).

Regards,
Klaus
 

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