Generating Excel Documents
Text Document Templates can be used to create Microsoft Excel format files in the Microsoft Excel 2003/2004 XML Spreadsheet format used by Architect Loader Spreadsheets.
These spreadsheets may have multiple sheets, include bold text etc.
This example document generates a simple Excel file.
<?xml version="1.0" encoding="UTF-8"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="https://www.w3.org/TR/html401/">
<Styles>
<!-- Define a style called "Default" -->
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font ss:FontName="Arial" x:Family="Swiss" ss:Size="11" ss:Color="#000000"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<!-- Define a bold style which also has a text wrapping -->
<Style ss:ID="s63">
<Alignment ss:Vertical="Bottom" ss:WrapText="1"/>
<Font ss:FontName="Arial" x:Family="Swiss" ss:Bold="1"/>
<NumberFormat/>
<Protection/>
</Style>
</Styles>
<!-- Create a sheet called "Forms" -->
<Worksheet ss:Name="Forms">
<Table>
<Column ss:Index="1" ss:AutoFitWidth="0" ss:Width="110"/>
<Row>
<Cell ss:StyleID="s63"><Data ss:Type="String">Form Name</Data></Cell>
</Row>
<!-- Loop through all forms, ordering by Form Ordinal and create a row for each -->
{%- for form in draft.als_forms_set.all().order_by('Ordinal') -%}
<Row>
<Cell><Data ss:Type="String">{{ form.DraftFormName }}</Data></Cell>
</Row>
{%- endfor -%}
</Table>
</Worksheet>
<!-- Create a sheet called "Folders" -->
<Worksheet ss:Name="Folders">
<Table>
<Column ss:Index="1" ss:AutoFitWidth="0" ss:Width="110"/>
<Row>
<Cell ss:StyleID="s63"><Data ss:Type="String">Folder Name</Data></Cell>
<Cell ss:StyleID="s63"><Data ss:Type="String">Folder OID</Data></Cell>
</Row>
<!-- Loop through all Folders, ordering by Folder Ordinal and create a row for each -->
{%- for folder in draft.als_folders_set.all().order_by('Ordinal') -%}
<Row>
<Cell><Data ss:Type="String">{{ folder.FolderName }}</Data></Cell>
<Cell><Data ss:Type="String">{{ folder.OID }}</Data></Cell>
</Row>
{%- endfor -%}
</Table>
<!-- Set an autofilter from Row 1 Column 1 to Row 9999 and column 2 -->
<AutoFilter xmlns="urn:schemas-microsoft-com:office:excel" x:Range="R1C1:R9999C2"/>
</Worksheet>
</Workbook>