How to Use IF Fields for Conditional Address Lines in WPS Writer Mail Merge
Question details
The user needs a WPS Writer mail merge address block that suppresses MailingAddressLine2 when it is blank and inserts it with the correct line break when it contains data.

- Product
- WPS Writer Mail Merge
- Device & OS
- not provided
- Scenario
- Creating a merged address layout where an optional second address line must not leave an empty row or break the address incorrectly.
- Observed behavior
- The conditional field may still produce a blank line, an unwanted space, or fail to force a line break when MailingAddressLine2 has data.
Before editing the merge logic, press Alt+F9 in WPS Writer to reveal field codes, then click inside the address block and remove any extra spaces, paragraph marks, or table-cell separators around MailingAddressLine2.
Insert an IF Field That Adds MailingAddressLine2 Only When It Contains Data
Use this as the default fix for a stacked address block where line 2 should be hidden when blank and placed on its own line when populated.
An IF field tests the merge field and includes the line break only when the value is not empty, which avoids empty-line suppression failures caused by spaces or paragraph marks.
Open the merged document in WPS Writer and click inside the address block where MailingAddressLine2 should appear.
Press Alt+F9 to display field codes and inspect the existing merge field and surrounding formatting.
Press Ctrl+F9 to insert field braces, enter IF MailingAddressLine2 <> "" "MailingAddressLine2 + line break" "", then place the cursor after MailingAddressLine2 inside the first quoted true text and press Enter to add the required line break.
Click inside the IF field and press F9 to update it, then press Alt+F9 again to preview the merged address result.

Place MailingAddressLine2 on the Same Line with a Conditional Comma
Use this variation when the address block should show line 2 on the same line as the street or city line instead of as a separate stacked line.
Set Up Conditional Address Lines in WPS Writer Mail Merge
WPS Writer lets you insert IF fields in a mail merge address block to suppress blank second address lines and format moved address data without extra spaces or blank rows. You can create the same Word-compatible merge layout directly in WPS Office.
- 1. Open your mail merge document in WPS Writer: Launch WPS Writer and open the .docx or WPS document that contains the mail merge recipient fields.
- 2. Go to Mailings and locate the address block: Click the Mailings tab, then select the address block or the merge field area where MailingAddressLine2 is inserted.
- 3. Add the IF field for line 2: Press Alt+F9 to show field codes, press Ctrl+F9 to insert field braces, and enter the IF MailingAddressLine2 condition with the desired line break or comma.
- 4. Update fields and preview: Press F9 to update, use Mailings > Preview Results to compare records, then finish the merge.

Frequently Asked Questions
Why does my blank MailingAddressLine2 still leave an empty line?
The empty-line suppression can fail when the merge field outputs a space, the line contains another character, or the merge field is placed in its own table row. Press Alt+F9 to inspect the field codes and remove any extra spaces, paragraph marks, or table-cell separators around the conditional field.
Can I make MailingAddressLine2 appear on the same line with a comma?
Yes. Use an IF field with the true text ", MailingAddressLine2" and the false text empty, then update the field with F9 to add the leading comma only when MailingAddressLine2 contains data.
How do I inspect mail merge field codes in WPS Writer?
Click inside the merge field and press Alt+F9 to display field codes. Press Alt+F9 again to return to the merged result preview.
Does WPS Writer support Word mail merge fields and IF rules?
Yes. WPS Writer opens .docx documents and preserves Word mail merge fields, including IF field conditions used for conditional address formatting.




