/** * Add a Link Element * * @param string $linkSrc * @param string $linkName * @param mixed $styleFont * @return PHPWord_Section_Link */ public function addLink($linkSrc, $linkName = null, $styleFont = null) { require_once __DIR__ . '/Link.php'; require_once __DIR__ . '/../Media.php'; // $text = @iconv("UTF-8", "UTF-8//IGNORE", $text); // $linkSrc = utf8_encode($linkSrc); if (!is_null($linkName)) { $linkName = @iconv("UTF-8", "UTF-8//IGNORE", $linkName); // $linkName = utf8_encode($linkName); } $link = new Document_Word_Writer_Section_Link($linkSrc, $linkName, $styleFont); $rID = Document_Word_Writer_Media::addSectionLinkElement($linkSrc); $link->setRelationId($rID); $this->_elementCollection[] = $link; return $link; }
/** * Add a Link Element * * @param string $linkSrc * @param string $linkName * @param mixed $styleFont * @param mixed $styleParagraph * @return PHPWord_Section_Link */ public function addLink($linkSrc, $linkName = null, $styleFont = null, $styleParagraph = null) { require_once __DIR__ . '/Media.php'; require_once __DIR__ . '/Section/Link.php'; $linkSrc = utf8_encode($linkSrc); if (!is_null($linkName)) { $linkName = utf8_encode($linkName); } $link = new Document_Word_Writer_Section_Link($linkSrc, $linkName, $styleFont, $styleParagraph); $rID = Document_Word_Writer_Media::addSectionLinkElement($linkSrc); $link->setRelationId($rID); $this->_elementCollection[] = $link; return $link; }
/** * Add a Link Element * * @param string $linkSrc * @param string $linkName * @param mixed $style * @return PHPWord_Section_Link */ public function addLink($linkSrc, $linkName = null, $style = null) { require_once __DIR__ . '/../../Media.php'; require_once __DIR__ . '/../Link.php'; if ($this->_insideOf == 'section') { $linkSrc = utf8_encode($linkSrc); if (!is_null($linkName)) { $linkName = utf8_encode($linkName); } $link = new Document_Word_Writer_Section_Link($linkSrc, $linkName, $style); $rID = Document_Word_Writer_Media::addSectionLinkElement($linkSrc); $link->setRelationId($rID); $this->_elementCollection[] = $link; return $link; } else { trigger_error('Unsupported Link header / footer reference'); return false; } }