Skip to main content

Creating Word Templates - Step-by-Step Guide

This guide shows you exactly how to create Word document templates for DocumentRenderV2Command with detailed formatting instructions.

Template 1: Simple Loan Agreement (Beginner)

Open Microsoft Word and Create:

═══════════════════════════════════════════════════════════════
LOAN AGREEMENT DOCUMENT
═══════════════════════════════════════════════════════════════

Agreement Date: {{agreementDate}}
Agreement Number: {{agreementNumber}}

PARTIES TO THIS AGREEMENT:

Lender:
BankLingo Financial Services
123 Banking Street
Financial District

Borrower:
Name: {{customerName}}
Customer ID: {{customerId}}
Address: {{customerAddress}}
Phone: {{customerPhone}}
Email: {{customerEmail}}

═══════════════════════════════════════════════════════════════
LOAN TERMS
═══════════════════════════════════════════════════════════════

Principal Amount: ${{loanAmount}}
Annual Interest Rate: {{interestRate}}%
Loan Tenure: {{tenure}} months
Monthly Payment: ${{monthlyPayment}}
First Payment Date: {{firstPaymentDate}}
Final Payment Date: {{finalPaymentDate}}
Total Interest: ${{totalInterest}}
Total Repayment: ${{totalRepayment}}

═══════════════════════════════════════════════════════════════
PURPOSE OF LOAN
═══════════════════════════════════════════════════════════════

{{loanPurpose}}

{{#if collateralRequired}}
═══════════════════════════════════════════════════════════════
COLLATERAL DETAILS
═══════════════════════════════════════════════════════════════

The borrower pledges the following as security for this loan:

Type: {{collateralType}}
Description: {{collateralDescription}}
Estimated Value: ${{collateralValue}}
{{/if}}

═══════════════════════════════════════════════════════════════
REPAYMENT SCHEDULE
═══════════════════════════════════════════════════════════════

[Create a table with 5 columns, 3 rows]

Row 1 Headers:
| Payment No. | Due Date | Principal | Interest | Total Payment | Balance |

Row 2 (add this marker in first cell):
{{#schedule}}

Row 3 (your data template):
| {{paymentNumber}} | {{dueDate}} | ${{principal}} | ${{interest}} | ${{total}} | ${{balance}} |

Row 4 (add this marker in first cell):
{{/schedule}}

═══════════════════════════════════════════════════════════════
TERMS AND CONDITIONS
═══════════════════════════════════════════════════════════════

1. The borrower agrees to repay the loan in {{tenure}} equal monthly installments
2. Late payments will incur a penalty of {{lateFeePercentage}}%
3. The loan may be prepaid without penalty
4. Default occurs if payment is {{defaultDays}} days overdue

═══════════════════════════════════════════════════════════════
SIGNATURES
═══════════════════════════════════════════════════════════════

Borrower Signature: _______________________ Date: ____________
{{customerName}}

Lender Representative: _______________________ Date: ____________
{{lenderRepresentative}}

═══════════════════════════════════════════════════════════════

How to Format in Word:

  1. Title Section:

    • Font: Arial, 16pt, Bold, Center-aligned
    • Add border lines using Insert → Shapes → Line
  2. Section Headers:

    • Font: Arial, 14pt, Bold
    • Background: Light gray shading
  3. Body Text:

    • Font: Arial, 11pt
    • Line spacing: 1.5
  4. Table:

    • Insert → Table → 5 columns, 4 rows
    • Header row: Bold, light blue background
    • Borders: All borders visible
  5. Conditional Section:

    • Simply type {{#if collateralRequired}} on its own line
    • Add the content
    • Type {{/if}} on its own line

Template 2: Account Statement (Intermediate)

Create this structure:

[Add Company Logo Here - Insert → Picture]

═══════════════════════════════════════════════════════════════
ACCOUNT STATEMENT
═══════════════════════════════════════════════════════════════

{{bankName}}
{{bankAddress}}
{{bankPhone}} | {{bankEmail}}

Statement Date: {{statementDate}}
Account Holder: {{customerName}}
Account Number: {{accountNumber}}
Account Type: {{accountType}}

Statement Period: {{startDate}} to {{endDate}}

═══════════════════════════════════════════════════════════════
ACCOUNT SUMMARY
═══════════════════════════════════════════════════════════════

Opening Balance ({{startDate}}): ${{openingBalance}}

Activity During Period:
Total Credits (+): ${{totalCredits}}
Total Debits (-): ${{totalDebits}}
─────────────────────────────────────
Net Change: ${{netChange}}

Closing Balance ({{endDate}}): ${{closingBalance}}

═══════════════════════════════════════════════════════════════
TRANSACTION HISTORY
═══════════════════════════════════════════════════════════════

[Create a table with 5 columns]

Row 1 Headers:
| Date | Transaction ID | Description | Debit | Credit | Balance |

Row 2:
{{#transactions}}

Row 3 (template):
| {{date}} | {{transactionId}} | {{description}} | {{#if isDebit}}${{amount}}{{/if}} | {{#if isCredit}}${{amount}}{{/if}} | ${{balance}} |

Row 4:
{{/transactions}}

═══════════════════════════════════════════════════════════════
NOTICES
═══════════════════════════════════════════════════════════════

{{#if hasNotices}}
{{#each notices}}
• {{this.notice}}
{{/each}}
{{/if}}

═══════════════════════════════════════════════════════════════

Questions? Contact us at {{bankPhone}} or {{bankEmail}}

This is a computer-generated statement and does not require a signature.

Page 1 of 1
═══════════════════════════════════════════════════════════════

Formatting Tips:

  1. Logo: Insert → Picture → Place at top, center-aligned
  2. Monospace for Numbers: Use Consolas or Courier New for amounts
  3. Alternating Row Colors: In table properties, set alternating row shading
  4. Currency Formatting: Always prefix with $ symbol
  5. Conditional Columns: Use {{#if}} inside table cells

Template 3: Certificate (Advanced)

Create with Fancy Formatting:

[Add decorative border: Page Layout → Page Borders → Art border]

┌─────────────────────────────────────────────────────────────┐
│ │
│ [Insert Logo] │
│ │
│ │
│ CERTIFICATE OF DEPOSIT │
│ │
│ │
└─────────────────────────────────────────────────────────────┘

Certificate Number: {{certificateNumber}}
Issue Date: {{issueDate}}


This is to certify that

{{customerName}}
(ID: {{customerId}})

has deposited with BankLingo Financial Services


PRINCIPAL AMOUNT: ${{depositAmount}}


under the following terms and conditions:

┌──────────────────────────┬────────────────────────────────┐
│ Interest Rate │ {{interestRate}}% per annum │
├──────────────────────────┼────────────────────────────────┤
│ Deposit Tenure │ {{tenure}} months │
├──────────────────────────┼────────────────────────────────┤
│ Maturity Date │ {{maturityDate}} │
├──────────────────────────┼────────────────────────────────┤
│ Maturity Amount │ ${{maturityAmount}} │
├──────────────────────────┼────────────────────────────────┤
│ Early Withdrawal Penalty │ {{penaltyPercentage}}% │
├──────────────────────────┼────────────────────────────────┤
│ Auto-Renewal Option │ {{renewalOption}} │
└──────────────────────────┴────────────────────────────────┘

This certificate is not transferable and must be presented at maturity.


Issued at: {{branchName}}
Branch Code: {{branchCode}}


[Signature line]
_______________________
Authorized Signatory
{{issuerName}}
{{issuerTitle}}



┌─────────────────────────────────────────────────────────────┐
│ This is a valuable document. Please keep it safe. │
│ For inquiries, contact: {{contactPhone}} │
└─────────────────────────────────────────────────────────────┘

Advanced Formatting:

  1. Decorative Border:

    • Design → Page Borders → Art → Choose decorative border
  2. Text Box for Title:

    • Insert → Text Box → Draw around title
    • Remove text box border if desired
  3. Centered Elements:

    • Select text → Center align (Ctrl+E)
  4. Fancy Font for Title:

    • Font: Georgia or Times New Roman, 24pt, Bold
  5. Table with Borders:

    • Use thick borders for emphasis
    • Shade header cells

Template 4: Collection Notice (With Urgency Formatting)

[Use red theme for urgency]

╔═══════════════════════════════════════════════════════════════╗
║ COLLECTION NOTICE ║
║ URGENT - ACTION REQUIRED ║
╚═══════════════════════════════════════════════════════════════╝

Notice Date: {{noticeDate}}
Notice Number: {{noticeNumber}}

TO: {{customerName}}
{{customerAddress}}

ACCOUNT DETAILS:
Account Number: {{accountNumber}}
Loan Number: {{loanNumber}}

═══════════════════════════════════════════════════════════════

OVERDUE PAYMENT ALERT

═══════════════════════════════════════════════════════════════

Your account shows an overdue payment:

┌─────────────────────────────────────────────────────────────┐
│ Original Due Date: │ {{dueDate}} │
│ Days Past Due: │ {{daysPastDue}} days [RED TEXT]│
│ Overdue Principal: │ ${{overduePrincipal}} │
│ Overdue Interest: │ ${{overdueInterest}} │
│ Late Fees: │ ${{lateFees}} │
│────────────────────────────────────────────────────────────│
│ TOTAL AMOUNT DUE: │ ${{totalAmountDue}} [RED BOLD] │
└─────────────────────────────────────────────────────────────┘

PAYMENT DEADLINE: {{paymentDeadline}} [RED, BOLD, HIGHLIGHT]

═══════════════════════════════════════════════════════════════
CONSEQUENCES OF NON-PAYMENT
═══════════════════════════════════════════════════════════════

Failure to pay by the deadline may result in:

{{#each consequences}}
⚠ {{this.consequence}}
{{/each}}

═══════════════════════════════════════════════════════════════
HOW TO MAKE PAYMENT
═══════════════════════════════════════════════════════════════

{{#each paymentMethods}}
METHOD {{@index}}: {{this.method}}
Details: {{this.details}}

{{/each}}

═══════════════════════════════════════════════════════════════

For assistance or to discuss payment arrangements:

Collections Department
Phone: {{collectionsPhone}}
Email: {{collectionsEmail}}
Hours: Monday - Friday, 9 AM - 5 PM

═══════════════════════════════════════════════════════════════

Reference this notice when calling: {{noticeNumber}}

╔═══════════════════════════════════════════════════════════════╗
║ PLEASE REMIT PAYMENT IMMEDIATELY TO AVOID FURTHER ACTION ║
╚═══════════════════════════════════════════════════════════════╝

Urgency Formatting:

  1. Red Color for Critical Info:

    • Select text → Font Color → Red
    • Use for: Days past due, total amount, deadline
  2. Yellow Highlight:

    • Select text → Text Highlight Color → Yellow
    • Use for: Payment deadline
  3. Warning Symbol:

    • Insert → Symbol → ⚠
    • Or type: (triangle) and it will auto-convert
  4. Bold Borders:

    • Table borders: 2-3pt thick
    • Use red border color

Working with Tables - Detailed Instructions

Simple Table (Non-Repeating)

Insert → Table → 2 columns, 3 rows

┌──────────────────────┬─────────────────────┐
│ Label │ Value │
├──────────────────────┼─────────────────────┤
│ Account Number │ {{accountNumber}} │
├──────────────────────┼─────────────────────┤
│ Opening Date │ {{openingDate}} │
└──────────────────────┴─────────────────────┘

Repeating Table Rows (Most Common)

Insert → Table → 4 columns, 4 rows

┌──────────┬─────────────┬──────────┬──────────┐
│ Date │ Description │ Amount │ Balance │ ← Row 1: Header
├──────────┼─────────────┼──────────┼──────────┤
│ {{#transactions}} │ ← Row 2: Start marker (put in first cell only)
├──────────┼─────────────┼──────────┼──────────┤
│ {{date}} │ {{desc}} │ ${{amt}} │ ${{bal}} │ ← Row 3: Template row
├──────────┼─────────────┼──────────┼──────────┤
│ {{/transactions}} │ ← Row 4: End marker (put in first cell only)
└──────────┴─────────────┴──────────┴──────────┘

Important:

  • Markers must be in separate rows
  • Only put marker in the first cell of the row
  • The row between markers is your template
  • That row will repeat for each item in the array

Tips and Tricks

1. Formatting Numbers

❌ Wrong: {{amount}}
✅ Right: ${{amount}} (format number to 2 decimals in context)

Example context:
{
amount: "1,234.56" // Pre-format in JavaScript
}

2. Dates

❌ Wrong: {{date}} → outputs "2026-01-17T00:00:00"
✅ Right: {{date}} with context: { date: "January 17, 2026" }

3. Booleans for Conditions

{{#if approved}}
APPROVED ✓
{{/if}}

{{#if !approved}}
REJECTED ✗
{{/if}}

Context must have: { approved: true } or { approved: false }

4. Lists without Tables

{{#each items}}
• {{this.name}}: {{this.value}}
{{/each}}

Context: {
items: [
{ name: "Item 1", value: "Value 1" },
{ name: "Item 2", value: "Value 2" }
]
}

5. Nested Objects

Customer: {{customer.name}}
Address: {{customer.address.street}}, {{customer.address.city}}

Context: {
customer: {
name: "John Doe",
address: {
street: "123 Main St",
city: "New York"
}
}
}

Common Mistakes to Avoid

❌ Mistake 1: Markers in Same Row

Wrong:
│ {{#schedule}} {{/schedule}} │

Correct:
Row 1: {{#schedule}}
Row 2: {{date}} | {{amount}}
Row 3: {{/schedule}}

❌ Mistake 2: Complex Expressions in Template

Wrong: {{amount * 1.1}}  ← Don't do calculations in template

Correct: Calculate in context before rendering
Context: {
amount: 100,
amountWithTax: 110 ← Calculate this beforehand
}
Template: {{amountWithTax}}

❌ Mistake 3: Mixing Syntax

Wrong: {{#if condition == true}}  ← Don't use == in template

Correct:
Context: { showSection: true }
Template: {{#if showSection}}

Saving Your Template

  1. Check Your Work: Review all placeholders for correct spelling
  2. Save As DOCX: File → Save As → Word Document (.docx)
  3. Name Clearly: Use descriptive names like loan-agreement-template-v1.docx
  4. Test First: Always test with sample data before production use

Next Steps

  1. Create your template following these guides
  2. Upload using CreateDocumentTemplateDefinitiionCommand
  3. Test with DocumentRenderV2Command
  4. Iterate and improve based on output

Need help? Refer to the main Template Guide for more details.