简体   繁体   中英

How to change styleTable on PHPWord?

I have a problem with using the plugin phpword. I'm trying to change the style, but I can change the background of the cell and other parameters are considered by it.

$styleTable = array('borderColor'=>'006699',
                    'borderSize'=>6,
                    'cellMargin'=>50,
                    'valign'=>'center'
                   );
$styleFirstRow = array('bgColor'=>'6086B8',
                       'color'=>'white',
                       'bold'=>true,
                       'size'=>11,
                       'valign'=>'center'
                    );
$PHPWord->addTableStyle('myTable', $styleTable, $styleFirstRow);

If you want to look my code, he as here : http://pastebin.com/pw36n3aW

I found where the problem was, it came from my settings that do not exist. Thank you for your time and help.

$styleFirstRow = array('bgColor'=>'#6086B8');
    $PHPWord->addTableStyle('myTable', $styleTable, $styleFirstRow);

    $styleCellFirstRow = array('valign'=>'center'); 
    $styleCell = array('valign'=>'center'); 

$styleTextFirstRow = array('name'=>'Lucida Sans Unicode', 'color'=>'white','size'=>12);
    $styleParagprapheFirstRow = array('align'=>'center');
    $table->addCell(2200, $styleCellFirstRow)->addText('Type du rapporteur', $styleTextFirstRow, $styleParagprapheFirstRow);

I am not sure but you can try this

array('borderColor'=>array('rgb' => '006699'), .....

Do you have this line in your code

$table = $section->addTable('myOwnTableStyle');

我认为您需要#定义颜色代码

    $styleTable = array('borderColor'=>'#006699',....and so on

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM