[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Insert Conditional Paragraph in Word Merge Template

Posted on 2011-02-17
1
Medium Priority
?
1,418 Views
Last Modified: 2012-05-11
Is there a way to insert a blank paragraph (or in otherwords a carriage return) in a word merge temlate that is based on one of the merge fields in the document's data source meating a certain condition?  For example, I have a letter template that contains a table near the bottom representing a CC block.  The block may contain 1, 2, or many names, each separated by a carriage return.  If the count of the names exceeds 7 then the remaining names print on the next page.  What I want instead is for the tempate to remove the paragraphs immediately above the CC table so all the names move up and the letter can still exist on one page.

Thanks in advance for your response.
0
Comment
Question by:SueJStevens
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 50

Accepted Solution

by:
Ingeborg Hawighorst (Microsoft MVP / EE MVE) earned 2000 total points
ID: 34920345
Hello,

this would be easiest if your source data contained a field with a count of the names, for example ccCount. Then you can use the {IF} field in your merge like

{ IF {MERGEFIELD ccCount} > 7 "<insert page break here>{MERGEFIELD ccName1} ¶
{MERGEFIELD ccName2} ¶
{MERGEFIELD ccName3} ¶
{MERGEFIELD ccName4} ¶
{MERGEFIELD ccName5} ¶
{MERGEFIELD ccName6} ¶
{MERGEFIELD ccName7} ¶
{MERGEFIELD ccName8} ¶
{MERGEFIELD ccName9}" "{MERGEFIELD ccName1} ¶
{MERGEFIELD ccName2} ¶
{MERGEFIELD ccName3} ¶
{MERGEFIELD ccName4} ¶
{MERGEFIELD ccName5} ¶
{MERGEFIELD ccName6} ¶
{MERGEFIELD ccName7} ¶
{MERGEFIELD ccName8} ¶
{MERGEFIELD ccName9}" }

The EE comment is not the best way to write field codes. Please do not write the {} manually, but use Ctrl-F9 to insert a field, then write between the brackets. The {IF} syntax is

{ IF condition "do when true" "do when false" }

You can have fields within the "do when true" and "do when false" and you need to enclose the whole "do when true/false" with double quotes. Within the "do when true/false" you can have paragraph marks, page breaks, etc.

I'll be happy to arrange the fields in your document, if you send me the merge document with the field names in place. You can replace the text with dummy text. I really only need the part with the CC block.

cheers, teylyn
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is often necessary in this forum and others to illustrate Word fields as text with the field delimiters replaced with the curly brackets that the delimiters resemble when field codes are being displayed on the document. This means that the text c…
I would like to show you some basics you can do with Mailings in MS Word. It´s quite handy feature you can use for creating envelopes, labels, personalized letters etc. First question could be what is this feature good for? Mailing can really he…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question