/** * renders list */ public function render() { $stream = $this->_rtf->getWriter(); $number = 0; foreach ($this->_items as $item) { // item is a list if ($item instanceof PHPRtfLite_List_Numbering) { if ($this instanceof PHPRtfLite_List_Numbering) { $item->setPrefix($this->_prefix . $this->getNumber($number) . $this->_separator); $item->setSuffix($this->_suffix); } } else { $number++; $listCharFontIndex = $this->getListCharFontIndex(); $listCharacter = $this->getListCharacter($number); $listCharDefinition = '{\\*\\pn\\pnlvlblt' . '\\pnf' . $listCharFontIndex; if ($this->_font) { $listCharDefinition .= '\\pnfs' . $this->_font->getSize() * 2; if ($color = $this->_font->getColor()) { $listCharDefinition .= '\\pncf' . $this->_rtf->getColorTable()->getColorIndex($color); } } $listCharDefinition .= '\\pnindent0{\\pntxtb ' . $listCharacter . '}}'; $textIndent = $this->_listIndent + $this->_textIndent; $stream->write('\\nowidctlpar\\fi-' . $this->_listIndent . '\\li' . $textIndent . "\r\n"); $stream->write($listCharDefinition); } // renders item $item->render(); if (false == $item instanceof PHPRtfLite_List) { $stream->write('\\par\\pard' . "\r\n"); } } }
/** * renders cell definition */ public function renderDefinition() { $stream = $this->_rtf->getWriter(); if ($this->isVerticalMerged()) { if ($this->isVerticalMergedFirstInRange()) { $stream->write('\\clvmgf'); } else { $stream->write('\\clvmrg'); } } $backgroundColor = $this->getBackgroundColor(); if ($backgroundColor) { $colorTable = $this->_rtf->getColorTable(); $stream->write('\\clcbpat' . $colorTable->getColorIndex($backgroundColor) . ' '); } switch ($this->getVerticalAlignment()) { case self::VERTICAL_ALIGN_TOP: $stream->write('\\clvertalt'); break; case self::VERTICAL_ALIGN_CENTER: $stream->write('\\clvertalc'); break; case self::VERTICAL_ALIGN_BOTTOM: $stream->write('\\clvertalb'); break; } switch ($this->getRotateTo()) { case self::ROTATE_RIGHT: $stream->write('\\cltxtbrl'); break; case self::ROTATE_LEFT: $stream->write('\\cltxbtlr'); break; } // NOTE: microsoft and all other rtf readers I know confound left with top cell padding if ($this->_paddingLeft) { $stream->write('\\clpadft3\\clpadt' . PHPRtfLite_Unit::getUnitInTwips($this->_paddingLeft) . ' '); } if ($this->_paddingTop) { $stream->write('\\clpadfl3\\clpadl' . PHPRtfLite_Unit::getUnitInTwips($this->_paddingTop) . ' '); } if ($this->_paddingBottom) { $stream->write('\\clpadfb3\\clpadb' . PHPRtfLite_Unit::getUnitInTwips($this->_paddingBottom) . ' '); } if ($this->_paddingRight) { $stream->write('\\clpadfr3\\clpadr' . PHPRtfLite_Unit::getUnitInTwips($this->_paddingRight) . ' '); } $border = $this->getBorder(); if ($border) { $stream->write($border->getContent('\\cl')); } }
/** * sets paragraph format for image * * @param PHPRtfLite_ParFormat $parFormat */ public function setParFormat(PHPRtfLite_ParFormat $parFormat) { $this->_parFormat = $parFormat; $parFormat->setColorTable($this->_rtf->getColorTable()); }
/** * sets border format for bottom border * * @param PHPRtfLite_Border_Format $borderFormat */ public function setBorderBottom(PHPRtfLite_Border_Format $borderFormat) { $borderFormat->setColorTable($this->_rtf->getColorTable()); $this->_borderBottom = $borderFormat; }