How to Control Bookmark Font Formatting in Word Templates
Question details
The user needs a way to maintain specific font formatting when bookmark text is programmatically replaced with generated values.

- Product
- Word
- Device & OS
- not provided
- Scenario
- Using a third-party application or script to automatically generate Word documents from a predefined template by replacing bookmark text.
- Observed behavior
- The resulting Word documents fail to preserve the font, size, and formatting defined at the bookmark location within the original template.
Ensure you have access to edit the original Word template file and determine whether your automated document generation tool requires traditional bookmarks or supports modern Content Controls.
Apply a Character Style to the Bookmark Range
Because bookmarks inherit the standard paragraph formatting by default, applying a dedicated character style to the bookmark ensures the replacement text adopts your exact font settings.
By default, bookmarks do not possess independent styling. When text is inserted programmatically, it often falls back to the surrounding paragraph's default font. Creating a specific character style binds the formatting directly to the bookmark text range.
Navigate to the Home tab and click the dialog launcher arrow in the bottom right corner of the Styles group (or press Alt+Ctrl+Shift+S). Click the 'New Style' button at the bottom of the pane. In the dialog, name your style and change the 'Style type' from Paragraph to 'Character'.
Under the Formatting section, select your desired font, size, color, and any other text attributes you want the generated text to use, then click 'OK' to save the style.
Highlight the text or placeholder space in your template where the bookmark is located. Click on your newly created character style in the Styles pane to apply it strictly to that selected range.

Use Content Controls Instead of Bookmarks
Content Controls are generally much more stable for automated document generation than bookmarks, which can be easily corrupted or accidentally deleted.
Use a VBA Macro to Apply Styles
If you cannot modify how the application inputs the text, a VBA macro can be utilized to locate the bookmarks and apply the correct style automatically after insertion.
Create and Format Templates Seamlessly with WPS Writer
WPS Office provides robust tools for building templates, managing bookmarks, and controlling granular document formatting. You can easily set up character styles to ensure your automated documents look perfect every time you generate them.
- 1. Open WPS Writer: Launch WPS Office and click on 'Document' to create a new file or open your existing template.
- 2. Insert a Bookmark: Navigate to the Insert tab, click on 'Bookmark', type a recognized name for your placeholder, and click 'Add'.
- 3. Define a Character Style: Go to the Home tab, click the Styles and Formatting icon to open the right-side panel, create a new Character Style with your desired font, and apply it to the bookmark.
- 4. Save as Template: Click Menu > Save As, and choose 'Word Template (*.dotx)' to save your perfectly formatted layout for automated generation.

Frequently Asked Questions
Why do my Word bookmarks lose formatting when text is replaced?
By default, bookmarks act merely as positional markers and do not possess independent styles. When an application programmatically replaces the bookmark with new text, the text inherits the default paragraph style rather than retaining the visual formatting you may have manually applied to the bookmark placeholder.
What is the difference between a bookmark and a content control?
A bookmark is a named location or selection of text that can easily be overwritten or accidentally deleted by users. A content control is a dedicated structural container designed specifically to hold data, making it much more robust for templates and automated document generation.
How do I ensure a replaced bookmark uses bold formatting?
You must create a new Character Style in your Styles pane, set its formatting to Bold, and apply this specific Character Style to the placeholder text of the bookmark in your template. The generated text will then inherit this applied character formatting.




