Forum


Replies: 1   Views: 2662
Add border, margin and padding for addformelement textbox field
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 admin  · 31-05-2017 - 07:39

Hello,

That styles are applied to paragraphs (as you can read on its page API: 'This is an array including all general paragraph wide options.').

For example this code adds a border to the paragraph of the textfield:

$textFieldOptions = array(
        'defaultValue' => 'This is a test',
        'border'=>'single',
        'borderColor'=>'000000',
);
$docx->addFormElement('textfield', $textFieldOptions);

Paragraph styles are ignored for inline elements. On the addText method API page you can read the supported rPr styles: underline, bold, color, italic, linebreak, spacing, strikeThrough...

About indentation, MS Word supports adding left and right indentations for paragraphs, but not for characters. phpdocx supports indentations and spacings for paragraphs as well. As MS Word allows, you can use tabs or add spaces to separate text contents in the same paragraph.

The next version of phpdocx will add rStyles ID support. We have also added a task to add rPr borders per your request.

Regards.