Basically, our users want the form field to be highlighted yellow if data does not exist. I tried highlight and background property and still did not work. If I used the document builder object then it works fine, however, I need form field hightlighted, not text. Can you help? Thanks.
You currently cannot use FormField.Font properties to do highlighting. I have logged it as a defect. It will be corrected in one of our future releases.
FormField is just one of the nodes of the complete form field. A complete form field consists of: FieldStart, BookmarkStart, Run (field code), FormField, FieldSeparator, Run (field result), BookmarkEnd, FieldEnd.
To set color of text in a form field you need to set that color on all runs from the FieldSeparator of the form field to the FieldEnd.
You can get the field separator using FormField.NextSibling, then keep going through NextSibling until you reach FieldEnd. Everything in between, if its a Run, set its font. If its a BookmarkEnd, ignore it.
I can only add that setting shading does not work because MS Word uses the gray background for form fields anyway on top of the shading. You can easily try that in MS Word itself, select a form field and set shading - you will still see a normal form fields. Therefore you need to use highlighting like shown above.