Adding checkboxes to a docx document with PHPDocX

  • Jun 06, 2011

The addTemplateCheckbox method has been deprecated. If you want to add a checkbox to a template we recommend the method used in Checkboxes as plain symbols.
We have added support for checkboxes intemplates in the new PHPDocX 2.3 version.
You can add checkboses to an existing template as follows:

$CHECK_1$ Field One
$CHECK_2$ Field Two
$CHECK_3$ Field Three

Add some checkboxes is really easy, use this code for a template:

require_once '../../classes/';

$docx = new CreateDocx();
// Calling the template

$docx->addTemplateCheckBox('1', 'First');
$docx->addTemplateCheckBox('2', 'Second');
$docx->addTemplateCheckBox('3', 'Third');