Document Placeholder Replacer helps you generate DOCX documents dynamically by replacing placeholders in Word templates with real data at runtime.
It is designed for common business scenarios like contracts, offer letters, invoices, reports, and any situation where a standard Word template needs to be personalized with dynamic values.
Start with a DOCX template that contains placeholders
Pass the template as Binary Data
Provide a list of key–value pairs
The service replaces all matching placeholders
The updated DOCX is returned as Binary Data
The replacement is safe even when placeholders are split across Word runs or placed inside tables, headers, or footers.
ReplacePlaceholders
This action replaces all placeholders in the given DOCX document using the provided key–value pairs.
DocumentThe DOCX file content as Binary Data.
PairsA list of placeholder key–value pairs.
PlaceholderFormatThe placeholder format used in the document.Default format is {{KEY}}.
{{KEY}}
UpdatedDocumentThe updated DOCX file returned as Binary Data.
Each placeholder pair contains:
Key – the placeholder name
Value – the text that should replace it
The placeholder format must contain the word KEY.
Common examples:
{{KEY}} → {{Name}}
{{Name}}
[[KEY]] → [[InvoiceNumber]]
[[KEY]]
[[InvoiceNumber]]
%KEY% → %Date%
%KEY%
%Date%
If no format is provided, {{KEY}} is used automatically.
The action throws clear runtime errors when:
The input document is empty or invalid
The placeholder list is empty
Duplicate placeholder keys are provided
The placeholder format does not contain KEY
KEY
The DOCX file is corrupted
These errors can be handled using standard OutSystems exception handling.
Only DOCX format is supported
Placeholders inside images or charts are not replaced
When placeholders span multiple Word runs, formatting may be unified
Designed for server-side execution
Contract generation
Offer letters
Invoices and statements
Report generation
Workflow-based document automation