Enable In-System Custom Template Editing with Visual Merge Field Mapping across All Export Templates
Problem Statement
Custom export templates across OSS modules (including Audits, Safety Reports, Certificates, and related document exports) currently rely on Microsoft Word Content Controls mapped to Custom XML schemas. For data fields to populate successfully during document generation, placeholders must remain enclosed within correctly mapped Content Controls, with repeating table rows requiring specific inline Plain Text slots.
The current authoring workflow requires users to:
Export a .docx template file from OSS.
Open the template in Microsoft Word on Windows.
Enable Developer > Design Mode and open the XML Mapping Pane.
Select the module's Custom XML schema (e.g., https://schemas.avinet.com.au).
Manually locate nodes and insert them as inline Plain Text Content Controls.
Save and re-import the .docx template into OSS.
However, Microsoft Word 365 for Mac does not include the XML Mapping Pane or Custom XML binding tools. As a result, Mac users cannot view available schemas, insert newly supported fields, or verify that fields have retained their Content Control wrappers after making layout adjustments. When a Mac user moves or styles a field, Word often strips the underlying XML binding, leaving only raw placeholder text (e.g., <<FieldName>>) that fails to resolve during document generation.
Currently, editing on macOS requires a complex workaround involving extracting the .docx archive, manually editing raw XML in customXML/item.xml, repackaging via Terminal commands, or running Python scripts to re-inject relationships. This process is fragile, time-consuming, and not viable for regular template customisation.
Proposed Enhancement
Introduce an In-System Custom Template Editor within OSS that allows users to customise, layout, and map templates directly in the web application—eliminating the need for external XML mapping tools in Microsoft Word.
This functionality should build upon existing UI patterns already familiar to users in OSS, such as the rich-text editing and "Merge Field" selection seen in Safety Options > Report Templates > Email Template Body configuration section.
In-System Visual Template Viewer / Editor:
Under template management pages (e.g., Audit Settings & Options > Export Templates, Safety Options > Report Templates, etc.), provide an integrated visual editor.
When a base template (containing company branding, logos, headers, footers, and table layouts) is uploaded, allow users to view and edit the template layout directly in OSS, similar to the Email Template Body editor.
Drag-and-Drop Merge Field / XML Palette:
Allow users to simply drag and drop (or double-click to insert) merge fields directly into the document body or specific table cells.
The system automatically generates the field as a correctly bound inline slot behind the scenes, ensuring full compatibility with repeating rows and backend document generation.
Template Validation on Save / Import:
Automatically scan the document upon saving to verify that all inserted merge fields are valid and correctly positioned within their respective parent/repeating sections.
Highlight any legacy raw text placeholders or broken tags before the template is published.