View Single Post
  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Mail Merge and paragraph formatting

Off the top of my head: have you tried formatting the paragraph(s) that
contain the { IF } field sequence with the formatting you want (i.e. as
well as the paragraphs inside the IF field results)?

Peter Jamieson

http://tips.pjmsn.me.uk

On 21/02/2010 17:50, Seamus O'Connell wrote:
The problem looks like this:

In an xlsx worksheet Row 1 contains three column names: €˜Line1, €˜Line2,
€˜Line3.
In Row 2, the first data row:
the Line1 cell contains €˜one one one €¦. one one one in a line of text which
runs over to two lines in a Word document;
the Line2 cell is empty;
the Line3 cell contains €˜three three three €¦ three three three, another
overrunning line of text.

A docx document uses Mail Merge for a Directory and for each record outputs
Line1, Line2, and Line3 on succeeding lines, prefixed by identifying text,
suppressing the line if the cell is empty, and applying the Hanging Indent
paragraph format on each output line. So the output in this case should look
like:
Line1: one one oneetc€¦
one one onethe overrunning part of Line1 text
Line3: three three threeetc€¦
three three threethe overrunning part of Line3 text

I have encoded each line as (p+hi indicates a paragraph mark with hanging
indent set):
{ IF { MERGEFIELD Linen } "" "Linen: { MERGEFIELD Linen }p+hi" "" }

The paragraph mark is acted up on when field codes are shown so it all comes
out as:
{ IF { MERGEFIELD Line1 } "" "Line1: { MERGEFIELD Line1 }p+hi
" "" }{ IF { MERGEFIELD Line2 } "" "Line2: { MERGEFIELD Line2 }p+hi
" "" }{ IF { MERGEFIELD Line3 } "" "Line3: { MERGEFIELD Line3 }p+hi
" "" }

However, in the result the lines are all indented, coming out like this:
Line1: one one oneetc€¦
one one onethe overrunning part of Line1 text
Line3: three three threeetc€¦
three three threethe overrunning part of Line3 text

Can anyone tell me what's going on and how to fix it?