修改文件 phpoffice\phpword\src\PhpWord\Style\Cell.php
找到函数 : setTextDirection
添加 $enum 的属性 : tbRlV
添加后如下:
/**
* Set text direction
*
* @param string $value
* @return self
*/
public function setTextDirection($value = null)
{
$enum = array(self::TEXT_DIR_BTLR, self::TEXT_DIR_TBRL, self::TEXT_DIR_TBRLV);
$this->textDirection = $this->setEnumVal($value, $enum, $this->textDirection);
return $this;
}
使用:
$table->addRow(5000);
$cell = $table->addCell(2000, ['valign' => 'center','textDirection'=>\PhpOffice\PhpWord\Style\Cell::TEXT_DIR_TBRLV]);//文字方向 竖立 从右往左
$cell->addText('设计(论文)的主要内容、水平、效果、推广价值及创新之处',$this->songxiao4);