Results 1 to 2 of 2
Thread: Detect number of lines (2003)
2005-05-17, 06:19 #1
- Join Date
- Feb 2005
- Thanked 0 Times in 0 Posts
Detect number of lines (2003)
I need to merge 2000+ records. The layout of the master document is mostly tables. I have one field Address at table 1 that is causing an issue. Here goes: Most of the address can fit into one line, but there are at least 20% that wrap to next line. Is there a way to detect using Word Field that if address falls into 2 lines, insert only one Enter at certain position (say X); if address falls into single line, insert two Enters at X. What I meant by Enter is pressing Enter on the keyboard.
What I did to work around this is to break the tables into a few tables. Insert a frame after X, put all the tables after table 1 into that frame, and lock that frame. It works so far, but I am wondering if there is a way to do it with Word Fields. A wild guess is by calculating number of characters of the address, but I do not think it is accurate.
Appreciate any suggestion.
2005-05-17, 06:56 #2
- Join Date
- May 2002
- Canberra, Australian Capital Territory, Australia
- Thanked 420 Times in 349 Posts
Re: Detect number of lines (2003)
Unfortunately, you can't split a single line into two or more parts with field coding, since Word's field abilities don't stretch to parsing text strings. You could if your two-line addresses had each line in a separate field in your source data, though.
However, even if the source address data consists of a single field, all is not lost. If you put your mergefield into a table cell, then you can use the table cell's width to force a line-wrap for long lines. With the appropriate paragraph formatting, you can even get the next line to indent so that it is clear in the output that this is a continuation of the previous line. That way, you don't need to code a line-feed at all.
If the problem is that you want to force a consistent spacing below the address, a table cell can help with that too. Just set its row height to 'exact' for the required height. You can get a similar result for this using fields, provided the source data has separate fields for each address line.
[MS MVP - Word]