Formatting Issues

How to Use IF Fields for Conditional Address Lines in WPS Writer Mail Merge

Huma Ashraf ChHuma Ashraf Ch Nov 13, 2026 869 views

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.

How to Use IF Fields for Conditional Address Lines in WPS Writer Mail Merge
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 you start

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.

Solution 1Recommended

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.

1
Open the mail merge address block in WPS Writer

Open the merged document in WPS Writer and click inside the address block where MailingAddressLine2 should appear.

2
Reveal field codes

Press Alt+F9 to display field codes and inspect the existing merge field and surrounding formatting.

3
Insert the IF field

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.

4
Update the field

Click inside the IF field and press F9 to update it, then press Alt+F9 again to preview the merged address result.

Insert an IF Field That Adds MailingAddressLine2 Only When It Contains Data
Correctly constructed IF field: A valid IF field hides blank address lines and preserves the paragraph break only when MailingAddressLine2 contains data.
WPS Writer Mail Merge

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. 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. 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. 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. 4. Update fields and preview: Press F9 to update, use Mailings > Preview Results to compare records, then finish the merge.
Create IF field rules that hide blank MailingAddressLine2 entries and preserve correct line breaksOpens and saves .docx Word mail merge documents for familiar formatting compatibilityWPS Writer provides a free, lightweight mail merge workflow with a familiar ribbon interfaceNo extra empty-line cleanup required when the conditional field is set up correctly
microsoft office alternative - wps office

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.