View Single Post
  #6   Report Post  
Bill Watkins
 
Posts: n/a
Default

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
he" 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).


"Graham Mayor" wrote in message
...
If you are going to insert a floating image then you are going to have to
use the autotext method. Position the word art before saving it as
autotext.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Bill Watkins wrote:
I've had a little more luck getting the WordArt pastes into the IF
field, but I'm having trouble getting reliable behaivior from the
field if the WordArt object is "floating". It seems like once the IF
field inserts the object as floating, it can't be removed by a later
update of the field. The floating object remains even if I delete
the entire field, and can only be deleted by direct deletion of the
object. (It's made more confusing, because there's no apparent
indication that the object is "in" the fieldcode.)

The behavior seems reliable if I insert the object as an in-line
"Picture", but in this case, you lose the object positioning
information and have to mess around with paragraph positioning (of
the field itself).

Inserting from Autotext also worked, but in this case, it looks like
you have to contend with template storage.

"Bill Watkins" wrote in message
...
Graham, thanks for the tip --

I had tried to find a way to "grab" the WordArt object and paste it
into the IF "action" field before I posted the question, but
couldn't figure a way to do it (I couldn't seem to find a link field
or anything similar "underneath" it that actually stored the
object). Can you suggest how to copy it?

Thanks,
Bill


"Graham Mayor" wrote in message
...
You can use the Word Art (in Word 2002/3) in the conditional field
just as if it were text,
or save the required artwork as an autotext entry and use the
conditional field to insert an autotext field to call the graphic.
eg
{IF {Mergefield fieldname} = condition "Put your Word Art here"}
or
{IF {Mergefield fieldname} = condition "{Autotext "name"}"}

You will have to build the condition by hand using CTRL+F9 for the
field delimiters.
--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Bill Watkins wrote:
Is there a way using the IF field to conditionally include a
WordArt object?

Thanks.