Permalink
Fetching contributors…
Cannot retrieve contributors at this time
112 lines (109 sloc) 2.13 KB
metadata:
title: Using a .docx template
short title: .docx
documentation: "https://docassemble.org/docs/documents.html#docx template file"
example start: 11
example end: 11
---
modules:
- docassemble.base.util
---
objects:
user: Individual
adverse_party: Individual
---
question: |
Assembling a document from a .docx
template
subquestion: |
This interview will fill fields in
a .docx template. You can
[download the template] to see what
it looks like.
The letter will be sent by the
user to an adverse party to
complain about something.
[download the template]: ${ url_of('letter_template.docx') }
field: introduction_shown
---
question: |
What is your name?
fields:
- First Name: user.name.first
- Last Name: user.name.last
---
question: |
What is the adverse party's name?
fields:
- First Name: adverse_party.name.first
- Last Name: adverse_party.name.last
---
question: |
What is the address of ${ adverse_party }?
fields:
- Address: adverse_party.address.address
- Unit: adverse_party.address.unit
required: False
- City: adverse_party.address.city
- State: adverse_party.address.state
code: |
states_list()
- Zip: adverse_party.address.zip
required: False
---
question: |
What is the subject of your complaint?
field: subject_matter
choices:
- world peace
- overpriced coffee
- so many channels, nothing on
- youth unemployment
---
question: |
Please sign your name below.
subquestion: |
Your signature will be added to the letter.
signature: user.signature
under: |
${ user.name }
---
code: |
phone_number = "202-555-1234"
---
mandatory: true
code: |
introduction_shown
---
question: |
Here is your document.
subquestion: |
Does it meet your approval?
yesno: user_approves
attachment:
name: Your letter
filename: letter
docx template file: letter_template.docx
valid formats:
- pdf
- docx
---
mandatory: True
code: |
if user_approves:
success_screen
else:
fail_screen
---
event: success_screen
question: |
Great!
buttons:
Exit: exit
---
event: fail_screen
question: |
Sorry to hear that!
buttons:
Exit: exit
Restart: restart