Prevent error text appearing in Mail Merge when th

2019-09-02 14:51发布

I have a document that uses mail merge to display images that are retrieved as URLs from a spreadsheet pointing to the image and the code works well.

{ INCLUDEPICTURE "{ IF TRUE { MERGEFIELD my_photo_variable_name} }" \d }

The issue I have is that when there is no image URL for the current mail merge, an error message is displayed.

Error! Filename not specified. 

I am trying to engineer the code so that it just leaves the mail merge field blank like it does for text fields rather than display the error message.

I tried tried using an IF clause to determine if there is an image:

{IF { INCLUDEPICTURE "{ IF TRUE { MERGEFIELD my_photo_variable_name} }" \d }}

but that didn't work so I tried using another IF clause determine if the variable was a null value (no image):

{IF {{MERGEFIELD my_photo_variable_name} <> ""}{ INCLUDEPICTURE "{ IF TRUE {{MERGEFIELD my_photo_variable_name}  " \d }}

Both of these attempts do not even show the error message let alone the image. Anyone know a way around this or am I stuck with an error message?

1条回答
太酷不给撩
2楼-- · 2019-09-02 14:54

Turns out I was very close, incorrect curly bracket placement was what was causing my attempt to fail:

{IF {MERGEFIELD my_photo_variable_name} <> "" {INCLUDEPICTURE "{IF TRUE {MERGEFIELD my_photo_variable_name}}" \d} "Text to display if no picture available"}

Which translates as:

If there is no value for the image my_photo_variable_name, include the image in the mail merge.

If there is no value i.e no image, then display custom text Text to display if no picture available.

查看更多
登录 后发表回答