phpms-wordphpword

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


Solution

  • The problem came from my settings that do not exist:

    $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);