Conditional inclusion of WordArt?

B

Bill Watkins

Is there a way using the IF field to conditionally include a WordArt object?

Thanks.
 
G

Graham Mayor

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
B

Bill Watkins

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
 
B

Bill Watkins

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.
 
C

Charles Kenyon

If you display anchors for graphics it makes it a little easier. You can
drag and drop the anchor where you want your graphic to reside (even if it
shows up elsewhere on the page).
 
B

Bill Watkins

I guess this is postscript on this. I don't know whether trying to use the
IF field in a header was the problem, but at some point, having these
objects embedded in the IF field seems to send Word (2000) ballistic. The
graphic starts flashing and the memory count starts climbing. In one case,
Word just locked-up completely, taking several open documents with it.

The final form of the field I was working with was:
{ IF { DOCPROPERTY "Status" } = "Draft" "" \* MERGEFORMAT }, with the object
inserted as a Picture between the spaces after "Draft", and before the ""
(I put the double quotes in as the "else" text.) The graphic itself was a
large "Draft" watermark.

Other oddities when trying to work with the form was that when embedded in
the field, the graphic would occaisionlly become it's own brush, so if I
moved it, it dropped new copies of itself leaving a "trail".

I thought I had the INCLUDEPICTURE field approach working, but it too seemed
to have some flakey behaivior when used in a header, e.g., getting strangely
cropped or the graphic not being visible.
 
G

Graham Mayor

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
B

Bill Watkins

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).
 
B

Bill Watkins

PS -- I should mention that on one occaision when Word went nuts, I got some
messages about Normal.dot being changed / recovered. Not sure what caused
this or what the change was, but I zapped the resulting Normal.dot anyway to
get a fresh copy. (I do have up-to-date virus protection, so I don't think
it was anything nefarious.)
 
C

Charles Kenyon

Had you saved normal.dot after you added your AutoText to it (if you saved
it in normal.dot rather than your document template)?
 
B

Bill Watkins

I turned off the NAV Office plug-in option, but it had no apparent effect.
(We use MacAfee and Word 2000 in the office, and I had similar problems
there, albeit using a direct paste of the object into the IF field.)

Part of the triggering mechanism appears to be having the two pages in view
at the same time. It sometimes takes a bit of scrolling up and down over
the "border" between the pages before the fun starts. (Watch Winword in the
process list while doing this. What I've seen is some early oscillation in
memory, but then a steady rise, accompanied by CPU usage in the 50% range.)
 

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