/** * Test get/set hash index */ public function testHashCode() { $object = new Run(); $this->assertEquals(md5($object->getFont()->getHashCode() . get_class($object)), $object->getHashCode()); }
/** * Create text run (can be formatted) * * @param string $pText Text * @return \PhpOffice\PhpPresentation\Shape\RichText\Run * @throws \Exception */ public function createTextRun($pText = '') { $objText = new Run($pText); $objText->setFont(clone $this->font); $this->addText($objText); return $objText; }
public function testTableWithText() { $oRun = new Run(); $oRun->setText('Test'); $phpPresentation = new PhpPresentation(); $oSlide = $phpPresentation->getActiveSlide(); $oShape = $oSlide->createTableShape(); $oRow = $oShape->createRow(); $oCell = $oRow->getCell(); $oCell->addText($oRun); $oCell->createBreak(); $pres = TestHelperDOCX::getDocument($phpPresentation, '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); $element = '/office:document-content/office:body/office:presentation/draw:page/draw:frame/table:table/table:table-row/table:table-cell/text:p/text:span/text:line-break'; $this->assertTrue($pres->elementExists($element, 'content.xml')); }