/**
  * Create new instance with array
  */
 public function testConstructWithArray()
 {
     $oPreserveText = new PreserveText('text', array('size' => 16, 'color' => '1B2232'), array('alignment' => Jc::CENTER));
     $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Font', $oPreserveText->getFontStyle());
     $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Paragraph', $oPreserveText->getParagraphStyle());
 }
 /**
  * Create new instance with array
  */
 public function testConstructWithArray()
 {
     $oPreserveText = new PreserveText(htmlspecialchars('text', ENT_COMPAT, 'UTF-8'), array('size' => 16, 'color' => '1B2232'), array('alignment' => 'center'));
     $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Font', $oPreserveText->getFontStyle());
     $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Paragraph', $oPreserveText->getParagraphStyle());
 }
Example #3
0
 /**
  * Create new instance with array
  */
 public function testConstructWithArray()
 {
     $oPreserveText = new PreserveText('text', array('align' => 'center'), array('marginLeft' => 600, 'marginRight' => 600, 'marginTop' => 600, 'marginBottom' => 600));
     $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Font', $oPreserveText->getFontStyle());
     $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Paragraph', $oPreserveText->getParagraphStyle());
 }
Example #4
0
 /**
  * Add preserve text element
  *
  * @param string $text
  * @param mixed $fontStyle
  * @param mixed $paragraphStyle
  * @return PreserveText
  */
 public function addPreserveText($text, $fontStyle = null, $paragraphStyle = null)
 {
     $this->checkValidity('preservetext');
     $preserveText = new PreserveText(String::toUTF8($text), $fontStyle, $paragraphStyle);
     $preserveText->setDocPart($this->getDocPart(), $this->getDocPartId());
     $this->addElement($preserveText);
     return $preserveText;
 }