public function testGetContentWithTypeDotDash() { $borderFormat = new PHPRtfLite_Border_Format(1, '#888', PHPRtfLite_Border_Format::TYPE_DOTDASH); $colorTable = new PHPRtfLite_DocHead_ColorTable(); $borderFormat->setColorTable($colorTable); $this->assertEquals('\\brdrdashd\\brdrw20\\brsp0\\brdrcf2', trim($borderFormat->getContent())); }
/** * gets rtf code of object * * @param string $type rtf code part * @return string rtf code */ public function getContent($type = '\\') { $content = ''; if ($this->_borderLeft) { $content .= $type . 'brdrl' . $this->_borderLeft->getContent(); } if ($this->_borderRight) { $content .= $type . 'brdrr' . $this->_borderRight->getContent(); } if ($this->_borderTop) { $content .= $type . 'brdrt' . $this->_borderTop->getContent(); } if ($this->_borderBottom) { $content .= $type . 'brdrb' . $this->_borderBottom->getContent(); } return $content; }
/** * Gets rtf code for border * @param PHPRtfLite_Border_Format $borderFormat * @param PHPRtfLite $rtf * * @return string rtf code */ private function getBorderRtf(PHPRtfLite_Border_Format $borderFormat, PHPRtfLite $rtf) { $borderRtf = $borderFormat->getNotColoredPartOfContent(); $color = $borderFormat->getColor(); if ($color) { $rtf->addColor($color); $borderRtf .= '\\brdrcf' . $rtf->getColor($color); } return $borderRtf . ' '; }