Esempio n. 1
0
 /**
  * Get font style as object
  */
 public function testFontObject()
 {
     $font = new Font();
     $oText = new Text(htmlspecialchars('text', ENT_COMPAT, 'UTF-8'), $font);
     $this->assertEquals($font, $oText->getFontStyle());
 }
Esempio n. 2
0
 /**
  * Get font style as object
  */
 public function testFontObject()
 {
     $font = new Font();
     $oText = new Text('text', $font);
     $this->assertEquals($oText->getFontStyle(), $font);
 }
Esempio n. 3
0
 /**
  * Get style of individual element
  *
  * @param \PhpOffice\PhpWord\Element\Text $element
  * @param int $paragraphStyleCount
  * @param int $fontStyleCount
  */
 private function getElementStyle(&$element, &$paragraphStyleCount, &$fontStyleCount)
 {
     $fontStyle = $element->getFontStyle();
     $paragraphStyle = $element->getParagraphStyle();
     $phpWord = $this->getParentWriter()->getPhpWord();
     // Font
     if ($fontStyle instanceof Font) {
         $fontStyleCount++;
         $style = $phpWord->addFontStyle("T{$fontStyleCount}", $fontStyle);
         $style->setAuto();
         $element->setFontStyle("T{$fontStyleCount}");
         // Paragraph
     } elseif ($paragraphStyle instanceof Paragraph) {
         $paragraphStyleCount++;
         $style = $phpWord->addParagraphStyle("P{$paragraphStyleCount}", array());
         $style->setAuto();
         $element->setParagraphStyle("P{$paragraphStyleCount}");
     }
 }