The problem: templates that fail when they matter
You design a Word contract with tables and signature lines, click to generate a PDF from Opportunity or Contract and get a scrambled document or missing rows. Or signatures jump to the wrong page after a minor edit. If you’re the Salesforce Admin, you own this fix and you don’t want a developer involved every time.
This article gives concrete, clickable checks for Salesforce document templates: how to build repeating tables from child records, where to put signature anchor tags so they survive repagination, and simple file-size and merge-field hygiene that stops surprises.
How repeating tables work for Salesforce document templates
Repeating tables let you list child records (QuoteLineItems, OpportunityLineItems, or custom children like Order_Item__c) as rows. The trick is not magic — it’s disciplined template structure.
Designing the table in Word
- Start with a single table row that contains the merge fields for one child record: name, quantity, unit price, etc.
- Keep that row minimal. Don’t merge multiple child-field cells into one big merged cell — give each field its own cell.
- Do not add page breaks inside the row. Let the table break naturally across pages.
Map the table to Salesforce child records
When configuring the template in the DocuGen settings, point the repeating table to the child object: for example, Opportunity.OpportunityLineItems or Quote.QuoteLineItems. The template engine repeats the single row for each child record it finds.
Practical checks before you save
- Generate a test document with 1, 5 and 50 child rows. If you have a hypothetical deal with a 60-page agreement and 10 line items, also test a document with repeated long descriptions so you exercise pagination.
- If the table header should repeat on every page, use Word’s table properties to repeat header rows.
- Avoid nested tables and complex cell merges inside the repeating row — they often cause layout drift when rows wrap to multiple pages.
Anchor tags are how signatures stick to the right place even after content repaginates. The platform finds the anchor text and replaces it with the signer’s signature block. You don’t need fixed coordinates — and you shouldn’t use them.
Where to put anchor tags
- Use a unique, short anchor string in the exact spot you want the signature to appear. Place it on its own line in its own paragraph so it isn’t wrapped by surrounding text.
- Put the anchor after any paragraphs that can grow. For example, if you have a 300-word clause above the signature, place the anchor on a new line immediately after that clause.
- Don’t hide anchors inside tables or inside cells that might resize drastically. Anchors in simple paragraphs are the most reliable.
Signer position and repagination
Because the system uses anchor tags, the signature is located by text and moves with repagination. That means you can add or remove clauses without reworking coordinates. Still, always test with documents that grow and shrink: add a 2-page appendix, then remove it and run again.
File size, images and common merge-field mistakes
Large documents and heavy images are a source of failure. Salesforce Files supports up to 40 MB per document with this connector; Notes and Attachments is limited to 25 MB by Salesforce and can’t be raised. Keep that in mind when you include high-resolution images or long appendices.
Images and logos
- Compress logos and images to web resolution before inserting them into Word. If you need printing-quality images, consider attaching them as separate files rather than embedding at full resolution.
- Test generation with and without images to check file-size changes and layout shifts.
Merge-field hygiene
- Always test templates using records with empty optional fields. Missing data should leave a blank cell, not a placeholder like "null" or a long error string.
- For fields that can contain long text (Opportunity.Description, Contract.Terms__c), protect the surrounding layout by adding paragraph spacing and not placing anchors immediately after those fields.
- Avoid very long single-word strings (for instance, a pasted long URL without breaks). They can force odd table or page breaks.
Quick checklist before you hand a template to sales
- Test with 1, mid and maximum-sized record sets (including long descriptions and many line items).
- Confirm all signatures appear on the right pages by searching for the anchor text and the final signed PDF after a test run.
- Verify the final file size and decide whether to store in Files or Notes and Attachments (over 25 MB must go to Files).
- Document the expected child object for repeating tables: OpportunityLineItems, QuoteLineItems, or your custom
Order_Item__c.
If you follow these rules you’ll avoid the common failures admins see: missing rows in lists, signatures dropped on the wrong page, and documents that are too large to store where you expect. They don’t require code — just careful template structure and a few generation tests.
Savvy DocuGen fills Word and PDF templates from any Salesforce record, supports repeating child rows, uses anchor tags for signatures so they survive repagination, and writes the signed PDF back to the same record. Try these checks in your sandbox using a copy of a real Contract, Quote or Opportunity record to validate anchors, repeating tables and file size before you roll to users.
Ready to try it? Run a template test in your sandbox now.
Read next