Document Editing Problems

How to Use Word Bookmarks and REF Fields with Rich Text Controls

Huda QurayshiHuda Qurayshi Oct 29, 2026 870 views

Question details

The user needs to properly evaluate a rich-text content control using an IF field formula, as the field code cannot read the control's value directly.

How to Use Word Bookmarks and REF Fields with Rich Text Controls
Product
Microsoft Word / WPS Writer
Device & OS
not provided
Scenario
Evaluating dynamic rich-text content controls exported from systems like Dynamics CRM using logical IF field codes.
Observed behavior
The IF field evaluates the rich-text field incorrectly because it cannot natively read the content control value, sometimes returning a 'Reference source not found' error upon PDF export.
Before you start

Ensure your document contains the necessary rich-text content controls and familiarize yourself with inserting field braces using keyboard shortcuts (like Ctrl+F9), as manually typing curly brackets will cause the formulas to fail.

Solution 1Recommended

Wrap the Content Control in a Bookmark and Reference It

This method bypasses the limitation of IF fields not reading content controls by assigning a bookmark to the control and referencing that bookmark instead.

Directly referencing a rich-text content control within an IF field formula often yields incorrect results or errors. By placing a bookmark around the control and pointing the IF field to that bookmark via a REF field, the word processor can evaluate the logical condition accurately.

1
Create the Bookmark

Highlight the entire rich-text content control in your document. Go to the 'Insert' tab on the top ribbon, click on 'Bookmark' (sometimes located under 'Links'), enter a recognizable name without spaces (e.g., 'discountvalue'), and click 'Add'.

2
Insert Field Code Braces

Click where you want the logical result to appear. Press 'Ctrl+F9' on your keyboard to insert a new set of dynamic field braces. Do not type these manually.

3
Construct the Formula

Inside the newly created braces, type 'IF '. Then press 'Ctrl+F9' again to insert a nested set of braces for the reference. Inside the inner braces, type 'REF discountvalue'. Outside the inner braces, finish your condition: '> 0 "TRUE" "FALSE"'.

4
Update the Field

Your final code should look similar to { IF { REF discountvalue } > 0 "TRUE" "FALSE" }. Right-click the field and select 'Update Field', or simply press 'F9' while it is selected, to calculate and display the result.

Wrap the Content Control in a Bookmark and Reference It
Shortcut Tip: You can toggle the visibility of all field codes in your document by pressing Alt+F9. This makes it much easier to edit complex nested formulas.
Free Document Editor

Easily Manage Bookmarks and Field Codes in WPS Writer

WPS Writer provides robust support for advanced document automation, including content controls, bookmarks, and complex nested field codes like IF and REF. It processes dynamic data efficiently while offering a highly intuitive user interface.

  1. 1. Open your Document: Launch WPS Writer and open the document containing your rich-text controls.
  2. 2. Insert Bookmarks: Highlight your target text or control, navigate to the 'Insert' tab, and select 'Bookmark' to assign a variable name.
  3. 3. Add Field Codes: Navigate to 'Insert' > 'Field', or use the standard 'Ctrl+F9' shortcut to seamlessly type your IF and REF logic.
  4. 4. Calculate Results: Right-click the formula and choose 'Update Field' (or press F9) to instantly evaluate your logical conditions.
Fully compatible with Microsoft Word DOCX formats, including legacy field codes.Easily insert, manage, and troubleshoot bookmarks with a clean, visual interface.Lightweight and fast, ensuring complex formulas calculate without lag.Free to download and use with a highly familiar tabbed workspace.
QA img-9

Frequently Asked Questions

Why does my IF field show the formula text instead of the actual result?

This happens if field codes are toggled to be visible or if you typed the curly braces manually. Field braces must be inserted using the Ctrl+F9 shortcut or via the Insert Field menu. To switch from viewing the formula to viewing the result, press Alt+F9.

Can I use spaces in my bookmark names?

No, bookmark names must begin with a letter and cannot contain any spaces. If you need to separate words for readability, use underscores instead (for example, 'discount_value').

Why do I get a 'Reference source not found' error when updating fields?

This error occurs if the bookmark referenced by the REF field has been accidentally deleted, typed incorrectly, or if the text containing the bookmark was replaced. Recreate the bookmark around your content control and ensure the exact same name is used in your field code.

Does WPS Writer support nested IF fields?

Yes, WPS Writer fully supports nested field codes, including complex IF statements with embedded REF fields. You can construct and evaluate them using the exact same syntax and Ctrl+F9 shortcuts.