/** * tests getContent(). */ public function testGetContent() { $this->_parFormat->setIndentLeft(5); $this->_parFormat->setIndentRight(5); $this->_parFormat->setSpaceBefore(5); $this->_parFormat->setSpaceAfter(5); $this->_parFormat->setIndentFirstLine(3); $this->_parFormat->setSpaceBetweenLines(1.2); $this->_parFormat->setShading(50); $this->assertEquals('\\ql \\fi1701 \\li2835 \\ri2835 \\sb100 \\sa100 \\sl288 \\shading5000 ', $this->_parFormat->getContent()); }
/** * renders footnote/endnote */ public function render() { $stream = $this->_rtf->getWriter(); $typeSetting = $this->_typeSettingType != self::TYPE_NORMAL ? '\\' . $this->_typeSettingType : ''; $stream->write('{' . $typeSetting . '\\chftn}' . '{' . $this->getTypeAsRtfCode() . '\\pard\\plain\\lin283\\fi-283 '); if ($this->_parFormat) { $stream->write($this->_parFormat->getContent()); } if ($this->_font) { $stream->write($this->_font->getContent()); } $stream->write('{\\up6\\chftn}' . "\r\n" . PHPRtfLite::quoteRtfCode($this->_text) . '} '); }
/** * renders footnote/endnote * * @return string */ public function getContent() { $content = '\\chftn ' . '{\\footnote' . ($this->isFootnote() ? '' : '\\ftnalt') . '\\pard\\plain \\lin283\\fi-283 '; if ($this->_parFormat) { $content .= $this->_parFormat->getContent($this->_rtf); } $content .= $this->_font->getContent($this->_rtf); $content .= '{\\up6\\chftn}' . "\r\n" . PHPRtfLite::quoteRtfCode($this->_text) . '} '; return $content; }
/** * Writes hyperlink to container. * * @param string $hyperlink hyperlink url (etc. "http://www.phprtf.com") * @param string $text hyperlinks text, if empty, hyperlink is written in previous paragraph format. * @param PHPRtfLite_Font $font font * @param PHPRtfLite_ParFormat $parFormat paragraph format, if null hyperlink is written in the same paragraph */ public function writeHyperLink($hyperlink, $text, PHPRtfLite_Font $font, PHPRtfLite_ParFormat $parFormat = null) { $content = $parFormat && count($this->_elements) != 0 && !$this->_emptyPar ? '\\par ' : ''; $content .= $parFormat ? $this->_pard . $parFormat->getContent($this->_rtf) : ''; $this->_emptyPar = false; $this->_elements[] = $content . '{\\field {\\*\\fldinst {HYPERLINK "' . $hyperlink . '"}}{\\fldrslt {'; $this->writeText($text, $font, null); $this->_elements[] .= '}}}' . "\r\n"; }