Document Export Custom Templates
Introduction
Welcome to the Document Export wizard, a nifty feature that made its grand entrance in Valispace's v1.8x.xx release! This wizard is your go-to for whipping up editable Microsoft Word .docx files straight from your requirements. Initially, we offered three preset templates, but guess what? Now, you can upload your very own templates into the wizard. How cool is that?
The wizard is fueled by the Python-Docx-Template library, which, in turn, leverages the Jinja Templating Engine. This dynamic duo allows you to craft custom templates, similar to our existing script-based solution: the https://docs.valispace.com/vhd/specification-export-based-on-microsoft-word-templ .
Python-Docx-Template Library
The Python-Docx-Template library is a powerful tool that extends the functionality of the Python-Docx library. It incorporates the Jinja Templating Engine, enabling dynamic content generation within your Word files. This means you can use variables, loops, and conditionals to populate your document with data on the fly. Essentially, it's like giving your Word doc a shot of espresso.
Default Templates
In this documentation, we've covered three templates, each progressively more complex than the last. So, if you're looking to up your template game, tackling them in sequence is a smart move. Here's the lineup:
Document View Document view Commented.docx
This one is your straightforward, run-of-the-mill template meant to produce an identical output to the requirements Document View. It's excellent for beginners and covers simple loops and variables.Specification Export Specification Export Commented.docx
Stepping it up a notch, this template introduces conditionals and filters. It's where things start to get spicy. It’s the Jinja version of our script based Word template with merge fields.Requirements V&V Matrix V&V Matrix Documented.docx
The grandmaster of our templates. This one's rich in nested loops and conditionals, and it even incorporates tables. If you can master this, you're basically a Jedi of document templating.
So there you go! You're all set to become the Document Export wizard's next wizard. May the templates be ever in your favor!
Feel free to add, remove, or modify sections to better fit your documentation needs.
Appendix - Data Object Structure
After going through the default templates files in the order given above, you might be feeling adventurous enough to test the limits of what you can include in your reports.
Here’s the basic structure of the object from which your templates will pull information from:
{
"specifications": [
{
"id": "number",
"name": "string",
"description": "string",
"requirements": [
{
"identifier": "string",
"text": "RichText",
"title": "string",
"rationale": "RichText",
"images": ["image"],
"type": "string",
"verification_methods": [{
"name": "string",
"component_vms": [{
"name": "string",
"closeout_reference": "string"
}]
}],
"specification_id": "number",
"group_id": "number",
"applicability_conditions": ["string"]
}
]
}
],
"requirements": [
{
"identifier": "string",
"text": "RichText",
"title": "string",
"rationale": "RichText",
"images": ["image"],
"type": "string",
"verification_methods": [{
"name": "string",
"component_vms": [{
"name": "string",
"closeout_reference": "string"
}]
}],
"specification_id": "number",
"group_id": "number",
"applicability_conditions": ["string"]
}
],
"requirements_groups": [
{
"id": "number",
"name": "string",
"description": "string",
"specification_id": "number",
"requirements": [
{
"identifier": "string",
"text": "RichText",
"title": "string",
"rationale": "RichText",
"images": ["image"],
"type": "string",
"verification_methods": [{
"name": "string",
"component_vms": [{
"name": "string",
"closeout_reference": "string"
}]
}],
"specification_id": "number",
"group_id": "number",
"applicability_conditions": ["string"]
}
]
}
],
"timestamp": "datetime"
}