View Single Post
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Limiting text to one line

Your best bet is if you can modify your data source to return a number
that is related to the length of the text. For example, if your data
source is Access, you may be able to create a query that returns the
number of characters in the company name. Then you can use a nested if
field that inserts the name formatted at various different point sizes
(or perhaps you squeeze the cahracters together a bit on particularly
long addresses).

e.g. you have a new field called textlen and you do something like

{ IF { MERGEFIELD textlen } 40 "{ MERGEFIELD companyname \*Charformat
}" "{ IF { MERGEFIELD textlen } 60 "{ MERGEFIELD companyname
\*Charformat }" "etc." }" }

where each { MERGEFIELD companyname \*Charformat } field is formatted
the way you want.

Obviously unless you are using a fixed width font the character count is
only a guide to the width of the inserted text but you can probably find
an approach that will work except in extreme cases.

If you can't get a measure of the text length from the data source, you
could I suppose do the same thing using a whole lot of IF fields that
use wildcards. In this case you would not need to nest. e.g.

{ IF { MERGEFIELD companyname } = "?" "{ MERGEFIELD companyname
\*Charformat }" ""
}{ IF { MERGEFIELD companyname } = "??" "{ MERGEFIELD companyname
\*Charformat }" ""
}{ IF { MERGEFIELD companyname } = "???" "{ MERGEFIELD companyname
\*Charformat }" ""
}{ IF { MERGEFIELD companyname } = "????" "{ MERGEFIELD companyname
\*Charformat }" ""
}

etc. Not sure how far that approach gets you but it's fairly easy to set
up and test.


Peter Jamieson

http://tips.pjmsn.me.uk

Mark wrote:
The main document that we use for a mail merge has a line for the name of the
company. This name merges from the database. How do I get the company name
to only fit on the one line regardless of length, within reason?