Ouch -- I think I stumbled into a nasty bug.
It appears that if I try to create a conditional graphic watermark in a
document by putting something like the following into an IF field in a
header, Word (2000 or 2003) will eventually go nuts:
{ IF { DOCPROPERTY Status} = "Draft" {AUTOTEXT DRAFTGRAPHIC \*
MERGEFORMAT }"Nothing" \* MERGEFORMAT }
(DRAFTGRAPHIC contains a Picture that started out as a WordArt object. The
Picture is set for behind text, and horizontal and vertial centering.)
As I posted in an earlier message in the thread, when I tried pasting the
object in question directly into the "success text" part of the IF field, I
got all kinds of weird effects from the graphic, including "cookie cutter
stamps" of the graphic, flashing graphics, etc., with Word eventually
choking. (That was in Word 2000.)
I thought adding the graphic via AutoText instead of paste to the IF field
was the fix, until I started adding a second page to the template I was
designing. (Using Word 2003 this time.) When I added the second page with
a Page Break, the weirdness started happening again. A look at the Task
Manager showed Word's memory climbing and Word grabbing up to 50% of the
CPU. Word itself wouldn't give me a cursor, wouldn't let me resize the
Window, and responded very slowly if at all to menu clicks or Close button
hits. The Spell checker also seemed to go off on tear, even though there
was only one line of text in a test document.
I did not see this behavior if the field code was placed in the body text,
only when in a header. I reproduced the behavior with a fresh template, new
graphics, and manually inserted field codes.
This is how I reproduced the problem in a very simple template (Word 2003):
Create a new template.
Create a simple WordArt object in the template.
Copy and Paste-Special that object as a Picture in the same template.
Set the Picture format to behind-text, and horizontally and vertically
centered.
Add the picture to that template's AutoText with a name like "DRAFTGRAPHIC".
Save the template.
Start a second template (the problem might reproduce in the original
template, but I didn't try that).
Use the Organizer to copy the AutoText item DRAFTGRAPHIC from the first
template into the second template.
If the property isn't already there, add a "Status" property to the second
template, and give it the value "Draft".
View Header/Footer.
Put the following field code into the header (I added some text like "It's
here:" in front of the field code --don't know if this has anything to do
with it or not.):
{ IF { DOCPROPERTY Status} = "Draft" {AUTOTEXT DRAFTGRAPHIC \*
MERGEFORMAT }"Nothing" \* MERGEFORMAT }
- Refresh the header. The graphic from the AutoText should now be visible
on the page.
So far, so good. Nothing wierd should be happening (that I've seen,
anyway). If the Task Manager is up, Word's CPU and memory stats should
appear stable.
- Leave the header and go the body text.
- Enter a manual Page Break. You should now have the picture showing on
both pages.
- Scroll up and down over both pages a few times. (Setting the view to "Two
Pages" seems to accelerate the effect -- there appears to be some
relationship with both copies of the picture being visible at the same
time.)
Things to look for at this point -- Word gets very "busy" and won't give you
a cursor or respond reasonably to menu or window operations, the spell
checker runs continuously, the title bar is grayed, CPU and memory usage
start rising, and if things get really hairy, you may catch two instances of
the document's task appearing in the Task Manager. (It seems like the more
stuff that's in the document, the faster things go to heck.)
The things that have been constant in my attempts to make this work have
been the combination of the IF field containing a graphic object (whether
directly pasted or via AutoText) in a header. On the surface, it looks like
this is causing either a memory leak, or some kind of infinite repagination
(which might explain the Spell checker behavior).