コード例 #1
0
ファイル: TextBreak.php プロジェクト: doit05/relProject
 /**
  * Set Text style
  *
  * @param mixed $style
  * @param mixed $paragraphStyle
  * @return string|\PhpOffice\PhpWord\Style\Font
  */
 public function setFontStyle($style = null, $paragraphStyle = null)
 {
     if ($style instanceof Font) {
         $this->fontStyle = $style;
         $this->setParagraphStyle($paragraphStyle);
     } elseif (is_array($style)) {
         $this->fontStyle = new Font('text', $paragraphStyle);
         $this->fontStyle->setStyleByArray($style);
     } else {
         $this->fontStyle = $style;
         $this->setParagraphStyle($paragraphStyle);
     }
     return $this->fontStyle;
 }
コード例 #2
0
 /**
  * Create a new Table-of-Contents Element
  *
  * @param mixed $fontStyle
  * @param array $tocStyle
  * @param integer $minDepth
  * @param integer $maxDepth
  */
 public function __construct($fontStyle = null, $tocStyle = null, $minDepth = 1, $maxDepth = 9)
 {
     $this->TOCStyle = new TOCStyle();
     if (!is_null($tocStyle) && is_array($tocStyle)) {
         $this->TOCStyle->setStyleByArray($tocStyle);
     }
     if (!is_null($fontStyle) && is_array($fontStyle)) {
         $this->fontStyle = new Font();
         $this->fontStyle->setStyleByArray($fontStyle);
     } else {
         $this->fontStyle = $fontStyle;
     }
     $this->minDepth = $minDepth;
     $this->maxDepth = $maxDepth;
 }
コード例 #3
0
ファイル: FontTest.php プロジェクト: brunodebarros/phpword
 /**
  * Test setting style values with normal value
  */
 public function testSetStyleValueNormal()
 {
     $object = new Font();
     $attributes = array('name' => 'Times New Roman', 'size' => 9, 'color' => '999999', 'hint' => 'eastAsia', 'bold' => true, 'italic' => true, 'underline' => Font::UNDERLINE_HEAVY, 'superScript' => true, 'subScript' => false, 'strikethrough' => true, 'doubleStrikethrough' => false, 'smallCaps' => true, 'allCaps' => false, 'fgColor' => Font::FGCOLOR_YELLOW, 'bgColor' => 'FFFF00', 'lineHeight' => 2, 'scale' => 150, 'spacing' => 240, 'kerning' => 10);
     $object->setStyleByArray($attributes);
     foreach ($attributes as $key => $value) {
         $get = is_bool($value) ? "is{$key}" : "get{$key}";
         $this->assertEquals($value, $object->{$get}());
     }
 }