conditional inclusion of pictures

M

Mercedes.K

Hi there...
I have created a form that has a dropdown list of airlines such as AlItalia,
Emirates, etc... and I've entered an IF / THEN string to include the logo of
the airline so that if Emirates is selected then the Emirates logo appears,
and so on and so forth.
I'm having a few issues though...
1) All the logos show, but one. For some reason when I "Update Field" after
selecting "Air France" the logo simply doesn't appear. I get a blank. As
far as I can see, the syntax is fine!
2) All the logos are saved at the same resolution of 200dpi and are all
approximately 3 inches wide and yet some show up at the right size and others
show up much smaller (about 1 inch wide)
3) Is there an easy way to have the "includepicture" field update
automatically? There are a number of users who will use this form and even
if I select to update fields in the options so that the form prints properly,
they're going to get confused when they don't see the logo pop up.

Here's a shortened version of what I have...
{IF {Dropdown1} = "Air France" "{Includepicture "D:\\Fake Stuff\\1 AWB
Logos\\AirFrance.jpg"}" {IF {Dropdown1} = "AlItalia" "{Includepicture
"D:\\Fake Stuff\\1 AWB Logos\\AlItalia.jpg"}" {IF {Dropdown1} = "Emirates"
"{Includepicture "D:\\Fake Stuff\\1 AWB Logos\\Emirates.jpg"}" "" }}}

Thanks so much
mercedes
 
P

Peter Jamieson

The first thing I would do is put double quotes around each "{dropdown1}"

Especially if you have any bookmarks that have the same name as any of the
possible values in the dropdown, or e.g. a bookmark called "Air".
 
G

Graham Mayor

I wouldn't bother trying to nest the fields. Simply include them one after
the next.

{ IF { Dropdown1 } = "Air France" "{ Includepicture "D:\\FAKE STUFF\\1 AWB
LOGOS\\Air France.jpg" }" }{ IF { Dropdown1 } = "Alitalia" "{ Includepicture
"D:\\FAKE STUFF\\1 AWB LOGOS\\Alitalia.jpg" }" }{ IF { Dropdown1 } =
"Emirates" "{ Includepicture "D:\\FAKE STUFF\\1 AWB
LOGOS\\Emirates.jpg" }" }

Nor do you need to 'update the fields'. Check the calculate on exit check
box of the dropdown field. When you tab out of the dropdown field the logo
field is updated.

Interestingly when I tested, the Air France logo wouldn't work here either.
The reason was I had a space between air and france in the filename but not
in the field. Check your spellings!

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
M

Mercedes.K

I tried putting the double quotes around each {Dropdown1} but that didn't
seem to make any difference. I also tried not nesting the IF statements but
now I'm not getting any logos showing up whether I've got "Calculate on exit"
checked in Dropdown1 or not. I can't see what I'm doing wrong.
I'm sure it's probably as silly as the Air France logo not showing up
previously but I'm just not seeing it!
As for Air France, thank you for pointing out the obvious! I actually
thought it had to be something that stupid on my part and I did look but
obviously I wasn't seeing very clearly by that point! Thank you!!!
 
G

Graham Mayor

This works as stated here

For each option in the drop down list that has an associated image you need
the following syntax

{ IF { Dropdown1 } = "Option" "{ Includepicture
"D:\\PATH\\FILENAME.jpg" }" }

Add each entry immediately after the first.

To display the updated image you must TAB out of a field that has the
calculate on exit checkbox checked. It doesn't have to be the one with the
dropdown list.

This field construction will not update if it is in the document header. For
that you will have to run a macro on exit from the field. The update macro
at http://www.gmayor.com/installing_macro.htm will work for that.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Graham Mayor

Simpler than the conditional fields, if both the entry and the filename are
the spelled the same, you could use

{ INCLUDEPICTURE "D:\\Fake Stuff\\1 AWB Logos\\{ DropDown1 }.jpg" }
or
{ INCLUDEPICTURE "D:\\Fake Stuff\\1 AWB Logos\\{ REF DropDown1 }.jpg" }

or you could use a macro solution, though frankly as you are distributing
the document I would avoid macros if possible.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
P

Peter Jamieson

2) All the logos are saved at the same resolution of 200dpi and are all
approximately 3 inches wide and yet some show up at the right size and
others
show up much smaller (about 1 inch wide)

Are you creating the graphics yourself or getting them from elsewhere? I
just wonder whether the .jpgs really are all the same size or whether they
look the same size in the application you usually use to check. (It's not an
area I'm particularly familiar with, otherwise I'd be more specific! You are
welcome to e-mail them to me (despam my e-mail
(e-mail address removed) by removing the KillmapS if you want to do
that) and I'll have a look.
 
M

Mercedes.K

Thank you both again.
Peter, I appreciate the offer to send you the images but I'm quite certain
they are the same size. In Photoshop, they're all 200dpi and are all
approximately 7cm wide (and between 1 and 7 cm high depending on the shape of
the logo (or approx 600 pixels wide by 100 to 600 high)

Graham, if you'll bear with me... I have NO idea why this isn't working.
Really liked your idea of simply referncing the dropdown name (so long as
it's the same as the file name). Didn't realise it could be done that way
but yes, makes perfect sense.
Sorry, this is all very new to me.
However, it won't work.
Here's my syntax, just as you said except that I moved the images into a new
folder...
{ Includepicture "d:\\Airlines\\1 AWB Logos\\{ REF DropDown1 }.jpg" }

But then I lock the form and test and no images appear and so I unlock and
every time I unlock, I find my syntax has changed to the following:
{ INCLUDEPICTURE "Airlines/1%20AWB%20Logos/.jpg" \* MERGEFORMAT }

Is that normal or am I doing something wrong?


Thank you both so much.
 
P

Peter Jamieson

But then I lock the form and test and no images appear and so I unlock and
every time I unlock, I find my syntax has changed to the following:
{ INCLUDEPICTURE "Airlines/1%20AWB%20Logos/.jpg" \* MERGEFORMAT }

Uncheck Word Tools|Options|General|Web Options|Files|Update links on save

For the image size thing, make sure there is no \*MERGEFORMAT switch in the
field. I doubt if that will fix it, but it seems the most likely culprit as
things stand!
 

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