Forum


Replies: 3   Views: 3391
Tickcheckbox in dynamic table
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by Andrew Goodricke  · 15-10-2013 - 16:05

Is there a way to set tick the checkboxes like in: http://www.phpdocx.com/api-documentation/templates/ticks-a-checbox-Word-document for a table?



We have a table that has checkboxes within the template row. e.g.




$BLOCK_TABLE$
Table header row
$VAR_ROW_NAME$, $
CHECK_IS_OPEN$
$BLOCK_TABLE$


 



The data I have is like:




$tableData = array(
array(
'VAR_ROW_NAME' => 'Monday'
, 'CHECK_IS_OPEN' => 0
),
array(
'VAR_ROW_NAME' => 'Tuesday'
, 'CHECK_IS_OPEN' => 1
)
);

$docx->addTemplateVariable($tableData, 'table', array('header' => false));


Thanks in advance.


Posted by jorgelj  · 15-10-2013 - 16:31

Hello,



There's no support for that, but a workaround is to use placeholders and replaceTemplateVariableByHTML. Something like:



$html = '<input type="checkbox" checked>';



$docx->replaceTemplateVariableByHTML('CHECK_IS_OPEN', 'inline', $html);



Regards.


Posted by Andrew Goodricke  · 16-10-2013 - 17:14

Thanks