Ejemplo n.º 1
0
 /**
  * Create text run (can be formatted)
  *
  * @param  string                           $pText Text
  * @return \PhpOffice\PhpPowerpoint\Shape\RichText\Run
  * @throws \Exception
  */
 public function createTextRun($pText = '')
 {
     $objText = new Run($pText);
     $objText->setFont(clone $this->font);
     $this->addText($objText);
     return $objText;
 }
Ejemplo n.º 2
0
 public function testTableWithText()
 {
     $oRun = new Run();
     $oRun->setText('Test');
     $phpPowerPoint = new PhpPowerpoint();
     $oSlide = $phpPowerPoint->getActiveSlide();
     $oShape = $oSlide->createTableShape();
     $oRow = $oShape->createRow();
     $oCell = $oRow->getCell();
     $oCell->addText($oRun);
     $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation');
     $element = '/office:document-content/office:body/office:presentation/draw:page/draw:frame/table:table/table:table-row/table:table-cell/text:p/text:span';
     $this->assertTrue($pres->elementExists($element, 'content.xml'));
     $this->assertEquals('Test', $pres->getElement($element, 'content.xml')->nodeValue);
 }
Ejemplo n.º 3
0
 /**
  * Test get/set hash index
  */
 public function testHashCode()
 {
     $object = new Run();
     $this->assertEquals(md5($object->getFont()->getHashCode() . get_class($object)), $object->getHashCode());
 }