How to Use Word Bookmarks and REF Fields with Rich Text Controls
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.

- 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.
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.
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.
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'.
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.
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"'.
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.

Fix 'Reference source not found' PDF Errors
Resolve reference errors that appear specifically when saving, updating, or exporting the document to PDF.
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. Open your Document: Launch WPS Writer and open the document containing your rich-text controls.
- 2. Insert Bookmarks: Highlight your target text or control, navigate to the 'Insert' tab, and select 'Bookmark' to assign a variable name.
- 3. Add Field Codes: Navigate to 'Insert' > 'Field', or use the standard 'Ctrl+F9' shortcut to seamlessly type your IF and REF logic.
- 4. Calculate Results: Right-click the formula and choose 'Update Field' (or press F9) to instantly evaluate your logical conditions.

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.




