Skip to main content

PHPWord Document Templates Overview

The ARP (Anugerah Remaja Perdana) module uses PHPWord TemplateProcessor to process pre-formatted .docx Word templates and output customized participant logbooks and report documents.

Key Concepts

  • Master .docx Template: Designers edit standard Word documents (.docx) containing placeholder variables enclosed in ${...} syntax (e.g., ${participant_name}, ${ic_number}).
  • TemplateProcessor Engine: PHPWord loads the .docx file, parses the internal document.xml structure, replaces variable tags, clones table rows dynamically, and injects image streams.
  • Output Formats: Outputs downloadable .docx files or streams them to LibreOffice / PDF converters.