예제 #1
0
 /**
  * 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->setArrayStyle($style);
     } else {
         $this->fontStyle = $style;
         $this->setParagraphStyle($paragraphStyle);
     }
     return $this->fontStyle;
 }
예제 #2
0
 /**
  * Test setting style values with normal value
  */
 public function testSetStyleValueNormal()
 {
     $object = new Font();
     $attributes = array('name' => 'Times New Roman', 'size' => 9, 'bold' => true, 'italic' => true, 'superScript' => true, 'subScript' => false, 'underline' => Font::UNDERLINE_HEAVY, 'strikethrough' => true, 'color' => '999999', 'fgColor' => Font::FGCOLOR_YELLOW, 'bgColor' => 'FFFF00', 'hint' => 'eastAsia');
     $object->setArrayStyle($attributes);
     foreach ($attributes as $key => $value) {
         $get = "get{$key}";
         $this->assertEquals($value, $object->{$get}());
     }
 }