How to change styleTable on PHPWord?

天大地大妈咪最大 提交于 2019-12-12 02:39:42

问题


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


回答1:


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



回答2:


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



回答3:


I think you need # to define color code

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


来源:https://stackoverflow.com/questions/17467771/how-to-change-styletable-on-phpword

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!