Generating Word Documents

Word documents are generated using a format called DocXMarkup developed by TrialGrid Ltd.

This example document generates a simple Word file. The DocXMarkup format provides facilities for tables and other layout options. Please see the references above for more examples.

<?xml version="1.0" encoding="utf-8" ?>
<document author="{{ user.username }}">

    <heading level="0">Annotate for {{draft.DraftName}}</heading>
    <para>{{ settings.get('preamble','No Preamble has been set') }}</para>

        <!--
             Decide whether to include forms based on the setting value called "do_forms"
             with a default of True
        -->
        {% if settings.get('do_forms', True) %}

            <!--
                 Loop through all the forms in the Draft, ordering the Forms by the "form_order setting
                 with a default of by "OID". This value must match one of the attributes of Forms
                 (OID, DraftFormName, Ordinal etc - see reference)
            -->

            {% for form in draft.als_forms_set.all().order_by(settings.get('form_order','OID')) %}
            <heading level="2">{{ form.DraftFormName }}</heading>
            {% endfor %}
        {% endif %}

</document>