Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Is there no conditional line print function or variable?
Hi:
N00b to Word mail merge here -- apologies in advance. I'm looking for a conditional line print function -- print/not print the line as the result of evaluating some expression. All the solutions I've seen here and elsewhere seem to involve the chaining of mergefield using the IF statement (http://www.gmayor.com/formatting_word_fields.htm - "Insert field information and associated text conditionally") or the code for example from Graham Major in his posting "Mail Merge and Printing Empty Fields", shown below: .................................................. ................... Mergefield FirstName} {Mergefield Lastname} {Mergefield Company} {Mergefield Address1} etc and when Company is empty you get an unwanted blank line. You can then manually insert your conditional entry on the previous line: {Mergefield FirstName} {Mergefield Lastname}{IF{Mergefield Company} "" " {Mergefield Company}"} {Mergefield Address1} etc Press 'enter' after the first " that defines the start of the conditional result. Thus if Mergefield Company is not empty ( "") then the result places the line feed *and* the Company field. If the mergefield *is* empty it does nothing. .................................................. ............................ The bug in this chained code is that if the first field is null, but the second is not, it will print a blank line first and then the second line field. Aside from that, it is incredibly unreadable to try to construct a multi-line output using a chained construction like this. But more generally, what is really needed here is a simple variable/field that evaluates an expression and either or prints or suppresses the print of the line that it is on. Isn't that possible? This chained code is not only wrong, but an incredible hack. FWIW, I've been using MicroPro InfoStar since around 1983. Its report writer has the ability to print/not print a line depending on the evaluation of an expression composed of data record fields. I'm assuming that Crystal Reports and other database-associated report writers have this capability. MicroPro's WordStar has it (per my recollection) -- doesn't Microsoft Word 2003? TIA -- Roy Zider |
#3
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Is there no conditional line print function or variable?
Peter: Thank you so much for your extended and comprehensive reply. That was exactly what I was looking for -- not only a confirmation of the workaround for suppressing the printing of blank lines, but some perspective on Word's Mail Merge functionality in general. I did subsequently discover the \f switch for MERGFIELD, which has the intended effect (for what appears to be single-variable lines with no other text on them). I just checked Wordstar, and my recollection was correct: .if, .ei, .el commands allow for conditional print -- very simple and straightforward. Word in comparison, in so many ways, is such a hack. It probably needs a complete rewrite. Thank you again for your thoughtful reply. -- Roy Zider |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
First line of letter appears in bold print | New Users | |||
Widowed line in a table | Tables | |||
The bottom line of a box won't print no matter what I do! | Microsoft Word Help | |||
Print preview shoud reflect all chosen print options | Microsoft Word Help | |||
Turning on the Print Screen Function | Microsoft Word Help |