/**
  * tests render().
  */
 public function testRender()
 {
     $hyperlink = new PHPRtfLite_Element_Hyperlink($this->_rtf, 'My link text!');
     $hyperlink->setHyperlink('http://www.phprtf.com/');
     $hyperlink->render();
     $expected = '{\\field {\\*\\fldinst {HYPERLINK "http://www.phprtf.com/"}}{\\fldrslt {My link text!}}}';
     $this->assertEquals($expected, trim($this->_rtf->getWriter()->getContent()));
 }
Exemple #2
0
 /**
  * writes hyperlink to container.
  *
  * @param string                $hyperlink          hyperlink url (etc. "http://www.phprtf.com")
  * @param string                $text               hyperlink text, if empty, hyperlink is written in previous paragraph format.
  * @param PHPRtfLite_Font       $font
  * @param PHPRtfLite_ParFormat  $parFormat
  * @param boolean               $convertTagsToRtf   if false, then html style tags are not replaced with rtf code
  * @return  PHPRtfLite_Element
  */
 public function writeHyperLink($hyperlink, $text, PHPRtfLite_Font $font = null, PHPRtfLite_ParFormat $parFormat = null, $convertTagsToRtf = true)
 {
     $element = new PHPRtfLite_Element_Hyperlink($this->_rtf, $text, $font, $parFormat);
     $element->setHyperlink($hyperlink);
     if ($convertTagsToRtf) {
         $element->setConvertTagsToRtf();
     }
     $this->_elements[] = $element;
     return $element;
 }