示例#1
0
 /**
  * Test endnote collection
  */
 public function testEndnotes()
 {
     $endnote1 = new \PhpOffice\PhpWord\Element\Endnote();
     $endnote2 = new \PhpOffice\PhpWord\Element\Endnote();
     $rId = Endnotes::addElement($endnote1);
     Endnotes::setElement(1, $endnote2);
     $this->assertEquals(1, $rId);
     $this->assertEquals(1, count(Endnotes::getElements()));
     $this->assertEquals($endnote2, Endnotes::getElement(1));
     $this->assertNull(Endnotes::getElement(2));
     Endnotes::resetElements();
     $this->assertEquals(0, Endnotes::countElements());
 }
示例#2
0
 /**
  * Add endnote element
  *
  * @param mixed $paragraphStyle
  * @return Endnote
  */
 public function addEndnote($paragraphStyle = null)
 {
     $this->checkValidity('endnote');
     $endnote = new Endnote($paragraphStyle);
     $rId = Endnotes::addElement($endnote);
     $endnote->setDocPart('endnote', $this->getDocPartId());
     $endnote->setRelationId($rId);
     $this->addElement($endnote);
     return $endnote;
 }