Forum


Replies: 1   Views: 118
Adding color to table border
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 fairshareitservices  · 16-09-2024 - 11:20

I have the below code which add a background color to the table row as below

$referenceNodeCell = array(
        'type' => 'table-cell',        
        'parent' => '/',
        'contains' => '${bgccr}',
    );
    $docx->customizeWordContent($referenceNodeCell,
        array(
            'backgroundColor' => 'FCE8DD',
        )
    );

    $referenceNodeCell = array(
        'type' => 'table-cell',
        'customQuery' => '//w:tr[contains(., "${bgccr}")]/w:tc/w:tcPr',
    );
    $docx->customizeWordContent($referenceNodeCell,
        array(
            'backgroundColor' => 'FCE8DD',
        )
    );

Now i want to add border color to the cell after adding background color

Posted by admin  · 16-09-2024 - 11:59

Hello,

On https://www.phpdocx.com/api-documentation/docxcustomizer/customize-docx-Word-documents-PHP you can read all supported styles in customizeWordContent.

A table-cell element supports the following style to set border styles:

borderColor  string  Hexadecimal color value: 'FF0000', '000000'... This value can be overridden for each side with the use of 'borderTopColor', 'borderRightColor', 'borderBottomColor' and 'borderLeftColor' properties.

Regards.