Build and Upload a DOCX Template
Design the document in Microsoft Word, add bracketed S-Docs syntax, upload the .docx file, and generate editable Word output from Salesforce data.
Use this page when you want Word-native design in Microsoft Word and a generated .docx output from Salesforce data.
A DOCX template is built in Word, then uploaded to S-Docs for generation.
Use DOCX when Word editing matters more than HTML layout or slide design.
Before you start
Make sure you have:
a new S-Docs template with format set to DOCX
the correct Related To Type for your base record
a
.docxfile you can edit in Microsoft Wordpermission to upload the latest Word file into Template Editor
Build and upload a DOCX template
Core DOCX syntax patterns
Merge fields
Wrap merge fields in square brackets.
Use this same pattern for relationship fields too.
Conditional logic
Wrap both RENDER tags in square brackets.
Keep merge fields inside rendered content in square brackets too.
Use the same operators you use in standard conditional logic.
Nested render blocks work too.
Named queries
Wrap both the query block and output fields in square brackets.
If you need a filtered or offset result, keep the same square-bracket wrapping.
Related list tables
DOCX related lists render inside Word tables.
Use the same table wrapper pattern used in Microsoft templates.
Use this structure exactly:
Put the opening block before the Word table.
Keep the table inside the
tableformatwrapper.Put the query and
<column>tags after the table.(For
<soql>tables) Make sure each<column>matches a field returned inSELECT.
Component templates
DOCX supports DOCX component templates.
Wrap the component reference in square brackets too.
Common syntax mistakes
Field prints as text: add square brackets around the merge field
Conditional block does not run: wrap both opening and closing
RENDERtags in square bracketsNamed query returns nothing: confirm the output field is wrapped in square brackets and included in
SELECTRelated list table breaks: confirm the Word table has a header row, an odd row, and an even row
DOCX generation fails: clear Word spelling and grammar markup, then re-upload the file
What DOCX supports
DOCX templates support these common S-Docs capabilities:
merge fields
conditional logic
named queries
related list tables
component templates
images and Word-native formatting
Important DOCX considerations
Keep these DOCX-specific rules in mind:
Live Edit is not supported.
DOCX formatting comes from Word, not CSS-driven page markup.
Related list tables must be built as Word tables.
You must re-upload the file after each Word change.
Word proofing markup can break generation.
Next reads by goal
Need a DOCX overview? Read Microsoft Word (DOCX).
Need DOCX setup considerations? Read DOCX Rendering Considerations.
Need merge field syntax? Read Merge Fields With Microsoft Templates (DOCX, PPTX, XLSX).
Need table setup examples? Read How to: Create a Table In Microsoft Templates (DOCX, PPTX).
Need conditional syntax? Read Quick Setup: Conditional Logic With Microsoft Templates (DOCX, PPTX, XLSX).
Need DOCX components? Read Component (DOCX).
Need to fix proofreading markup errors? Read DOCX Generation Failure: SpellStart, GramStart, or GramEnd.
Need attached total rows? Read How to Add a Subtotal Row to a DOCX Table.
Last updated
Was this helpful?

