【问题标题】:How to change styleTable on PHPWord?如何更改 PHPWord 上的样式表?
【发布时间】:2013-07-04 10:19:05
【问题描述】:

我在使用插件 phpword 时遇到问题。我正在尝试更改样式,但我可以更改单元格的背景,并且它会考虑其他参数。

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

如果你想看我的代码,他在这里:http://pastebin.com/pw36n3aW

【问题讨论】:

    标签: php ms-word phpword


    【解决方案1】:

    我发现问题出在哪里,它来自我不存在的设置。 感谢您的时间和帮助。

    $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】:

      我不确定,但你可以试试这个

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

      你的代码中有这行吗

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

      【讨论】:

      • 问题是我无法对焦,无法更改我的物品的大小或颜色。
      • 是的,我有:pastebin.com/pw36n3aW 如果你想完整地查看我的代码。你现在有
      【解决方案3】:

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

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

      【讨论】:

      • 感谢这个错误,但它不是来自那里。我的背景颜色和以前一样。
      猜你喜欢
      • 1970-01-01
      • 2017-03-06
      • 2014-03-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多