Exemple #1
0
 /**
  * Set/get relation Id
  */
 public function testRelationId()
 {
     $oLink = new Link('http://www.google.com');
     $iVal = rand(1, 1000);
     $oLink->setRelationId($iVal);
     $this->assertEquals($oLink->getRelationId(), $iVal);
 }
Exemple #2
0
 /**
  * Set/get relation Id
  */
 public function testRelationId()
 {
     $oLink = new Link('https://github.com/PHPOffice/PHPWord');
     $iVal = rand(1, 1000);
     $oLink->setRelationId($iVal);
     $this->assertEquals($iVal, $oLink->getRelationId());
 }
 /**
  * Add link element
  *
  * @param string $linkSrc
  * @param string $linkName
  * @param mixed $fontStyle
  * @param mixed $paragraphStyle
  * @return Link
  */
 public function addLink($linkSrc, $linkName = null, $fontStyle = null, $paragraphStyle = null)
 {
     $this->checkValidity('link');
     $elementDocPart = $this->checkElementDocPart();
     $link = new Link(String::toUTF8($linkSrc), String::toUTF8($linkName), $fontStyle, $paragraphStyle);
     $link->setDocPart($this->getDocPart(), $this->getDocPartId());
     $rId = Media::addElement($elementDocPart, 'link', $linkSrc);
     $link->setRelationId($rId);
     $this->addElement($link);
     return $link;
 }