/** * Add elements */ public function testAddElements() { $objectSource = __DIR__ . "/../_files/documents/reader.docx"; $imageSource = __DIR__ . "/../_files/images/PhpWord.png"; $imageUrl = 'http://php.net//images/logos/php-med-trans-light.gif'; $section = new Section(0); $section->addText(utf8_decode('ä')); $section->addLink(utf8_decode('http://äää.com'), utf8_decode('ä')); $section->addTextBreak(); $section->addPageBreak(); $section->addTable(); $section->addListItem(utf8_decode('ä')); $section->addObject($objectSource); $section->addImage($imageSource); $section->addTitle(utf8_decode('ä'), 1); $section->addTextRun(); $section->addFootnote(); $section->addCheckBox(utf8_decode('chkä'), utf8_decode('Contentä')); $section->addTOC(); $elementCollection = $section->getElements(); $elementTypes = array('Text', 'Link', 'TextBreak', 'PageBreak', 'Table', 'ListItem', 'Object', 'Image', 'Title', 'TextRun', 'Footnote', 'CheckBox', 'TOC'); $i = 0; foreach ($elementTypes as $elementType) { $this->assertInstanceOf("PhpOffice\\PhpWord\\Element\\{$elementType}", $elementCollection[$i]); $i++; } }