Forum


Replies: 1   Views: 399
Checkbox background color and tickmarks
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 gtassinari  · 29-12-2023 - 01:32

Hello,

Hello I am using PHPDOCX advanced version 14.I have been trying to add a checkbox background color as white, i have used both the bgColor as well as tried to color option. The bgColor keeps the background as grey, the color makes the border white but still keeps the background grey. See below my code as well as the output

            $wordFragment = new WordFragment($docx);
            $checkboxOptions = array(
                'fontSize' => 8,
                'defaultValue' => !empty($p['findings_detail']['environmentalLiensFound']),
                'backgroundColor' => 'FFFFFF'
            );
            $wordFragment->addFormElement('checkbox', $checkboxOptions);
            $docx->replaceVariableByWordFragment(array(
                'env_found' => $wordFragment,
                'env_found_detail' => $wordFragment
            ),
                array('type' => 'inline', 'firstMatch' => 'true'));

Output: https://pasteboard.co/pWiaEO1UagqH.png

Also, is there anyway to make the checkboxes windings character 254 like a tickmark instead of an 'X'

Thanks

Karthik