Parsing Word 2003 XML : Drop-Down Form Field Value

W

Wayne Feraera

I've also had the problem of trying to get dropdown or checkbox data out of
WordML. Below is what a small Drop-Down Form Field looks like in WordML.
I've tried to base64-decode the fldData put with no joy.

Can you help?


Thanks.


<aml:annotation aml:id="0" w:type="Word.Bookmark.Start" w:name="Dropdown1"/>
<w:p>
<w:r>
<w:fldChar w:fldCharType="begin">
<w:fldData>/////2aAAAAAAAkARAByAG8AcABkAG8AdwBuADEAAAAAAAAAAAAAAAAAAAAAAAAA­AAAAAAAA//8D
AAAABQBhAGwAcABoAGEABABiAGUAdABhAAcAYwBoAGEAcgBsAGkAZQA=
</w:fldData>
</w:fldChar>
</w:r>
<w:r>
<w:instrText> FORMDROPDOWN </w:instrText>
</w:r>
<w:r>
<w:fldChar w:fldCharType="end"/>
</w:r>
<aml:annotation aml:id="0" w:type="Word.Bookmark.End"/>
</w:p>
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?V2F5bmUgRmVyYWVyYQ==?=,
I've also had the problem of trying to get dropdown or checkbox data out of
WordML. Below is what a small Drop-Down Form Field looks like in WordML.
I've tried to base64-decode the fldData put with no joy.
No, it's in a proprietary, binary format. I've had discussion about this in
the office.developer newsgroups (you can search Google) and we've reached the
following conclusions

1. You cannot get the information from a dropdown field. Best you can do is
include code in your form that will write the dropdown field selection to
something else, such as a document property, document variable or a (hidden)
textbox form field

2. You can sorta get the information from a checkbox. The checked vs. the
unchecked states *in the same context* are always the same XML. By "same
context" I mean position in relation to other things. Things I've found that
affect the XML code of a checkbox:
- is it the default name, or have you named it
- is it alone in a table cell
- have you selected and bookmarked it

As long as you "know" the document - or better, have set it up - you can
reliably extract the checkbox information.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
W

Wayne Feraera

Cindy M -WordMVP- said:
Hi =?Utf-8?B?V2F5bmUgRmVyYWVyYQ==?=,

No, it's in a proprietary, binary format. I've had discussion about this in
the office.developer newsgroups (you can search Google) and we've reached the
following conclusions

1. You cannot get the information from a dropdown field. Best you can do is
include code in your form that will write the dropdown field selection to
something else, such as a document property, document variable or a (hidden)
textbox form field

2. You can sorta get the information from a checkbox. The checked vs. the
unchecked states *in the same context* are always the same XML. By "same
context" I mean position in relation to other things. Things I've found that
affect the XML code of a checkbox:
- is it the default name, or have you named it
- is it alone in a table cell
- have you selected and bookmarked it

As long as you "know" the document - or better, have set it up - you can
reliably extract the checkbox information.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)


This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
Hi,

Thanks for the reply.
I have a dropdown list called "Title" with 3 values (Mr. Miss. Mrs.)

You have written "You cannot get the information from a dropdown field".
As per your suggestion, I have placed a bookmark next to dropdown field(
will hide it later once it works), whose value is updated upon selecting
different values of Dropdown list. (New value selected is Miss)

Now I have read the value in this new hidden bookmark and have written it to
Database. That is also fine.

My Query is, "HOW CAN I SET THE INFORMATION TO DROP DOWN LIST". (i.e.
previously selected value i.e. MISS).

Whole of last week I was actually going through your articles only,
fortunately this is attended by you. Thanks.
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?V2F5bmUgRmVyYWVyYQ==?=,
My Query is, "HOW CAN I SET THE INFORMATION TO DROP DOWN LIST". (i.e.
previously selected value i.e. MISS).
Using XML respectively a transform? You cannot.

If you have macro code in the document, then an AutoOpen macro should be
able to do this. Roughly:

ActiveDocument.Formfields("XYZ").Result =
ActiveDocument.Bookmarks("Name").Range.Text

(Note: using this technique you can even add values to the list! So be
careful.)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 

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