At least
- Get rid of the ( and )
- actually insert a copy of the quickpart at each point in the field where you need it. I am assuming that this is what you mean by
[QUICKPART FIELDNAME]
- Surround the first one with double quotes, so you have
{ IF "[QUICKPART FIELDNAME]" = " " " " "[QUICKPART FIELDNAME]" }
Beyond that, it's a question of what you are trying to achieve and that depends a bit on which type of Document Property it is.
a. Some of these Document Properties are "traditional" builtin Word properties such as AUTHOR, wrapped in Content controls.
b. Some are new-style Document properties which are only available as content controls (e.g. Company Fax).
c. If you are using SharePoint, some may be controls that are set up as part of the document Content Type - their values may be filled in in the Sharepoint library, and so on.
All these "content control" versions of the properties are designed to update automatically when you change their value in Word, but
d. the result of the IF field itself will not update automatically (you'll need to select it and press F9, or some such).
e. in their "content control" form, none of the properties really lets you enter an empty value (not even the type (a) builtin properties). As soon as you do that, the "default text", e.g. [Company Fax] reappears, and that's what will actually be tested
in the IF field.
So the nearest you can usually get is to insert a single space to "empty" the field. I'm guessing that perhaps you want to do this:
If the property only contains space, insert nothing instead
Otherwise, insert the value of the property
In which case, at the very least, the above code needs to change to
{ IF "[QUICKPART FIELDNAME]" = " " "" "[QUICKPART FIELDNAME]" }
(i.e. change the " " result to a "" result)
However, that will not catch
f. the case where the field is completely blank and actually contains the default text,
g. the case where the field has been blanked using more than one space or other forms of white space.
I believe you may be able to get around at least the common cases using a set of fields as follows:
{ SET CC [QUICKPART FIELDNAME] }{ IF { =DEFINED(CC) } = 0 "" "{ IF "[QUICKPART FIELDNAME]" = "[Company Fax]" "" "[QUICKPART FIELDNAME]" }" }
(all the {} have to be the special field code braces you can insert using ctrl-F9)
However, I haven't tested that much
For a builtin property that has an underlying field code such as { AUTHOR }, you should be able to use the property field (not the content control) instead:
{ AUTHOR }
But as with the IF field, you'll have to update that field to see any change in the property value.