Page break on change of initial letter

S

Steve Monaghan

Trying to generate an internal directory, using a Text file (comma
separated fields) as the data source. How can I force a page break when
the initial letter of the Surname changes?
Using Word 2000, Windows XP.
Thanks.
 
P

Peter Jamieson

If you have a separate field for the initial letter, you can try something
like

{ IF { MERGESEQ } = 1 "{ SET init ' ' }"
"{ IF "{ MERGEFIELD Initial }" = "{ init }"
""
"<put a page break character here>{ SET init { MERGEFIELD Initial } }"
} }

If you do not, you could try something like

{ IF { MERGESEQ } = 1 "{ SET init ' ' }"
"{ IF "{ MERGEFIELD Surname \*Uppercase }" = "{ init }*"
""
"<put a page break character here>{
IF "{ MERGEFIELD Surname \*Uppercase }" = "A*" "{ SET init "A" }" ""
}{ IF "{ MERGEFIELD Surname \*Uppercase }" = "B*" "{ SET init "B" }" ""
}{ IF "{ MERGEFIELD Surname \*Uppercase }" = "C*" "{ SET init "C" }" ""
}" } }

where you have 26 IF statements, one for each letter of the alphabet. And
more, if you live somewhere where names can begin with digits, accented
characters etc.

(NB, I haven't tested the latter approach)
 

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