/** * tests setBorder on cell 2x2 * @depends testSetBorderForCellWithRow2Column1 * * @param PHPRtfLite_Table $table */ public function testSetBorderForCellWithRow2Column2(PHPRtfLite_Table $table) { $border = new PHPRtfLite_Border($table->getRtf()); $border->setBorders(new PHPRtfLite_Border_Format(1, '#888')); $cell2x2 = $table->getCell(2, 2); $cell1x2 = $table->getCell(1, 2); $cell2x1 = $table->getCell(2, 1); $cell2x2->setBorder($border); $this->assertEquals('#3F3', $cell1x2->getBorder()->getBorderTop()->getColor()); $this->assertEquals('#888', $cell1x2->getBorder()->getBorderBottom()->getColor()); $this->assertEquals('#888', $cell2x1->getBorder()->getBorderRight()->getColor()); }
/** * Gets rtf code for cell * * @return string rtf code */ public function getContent() { $content = '{'; switch ($this->_alignment) { case self::TEXT_ALIGN_LEFT: $content .= '\\ql'; break; case self::TEXT_ALIGN_CENTER: $content .= '\\qc'; break; case self::TEXT_ALIGN_RIGHT: $content .= '\\qr'; break; case self::TEXT_ALIGN_JUSTIFY: $content .= '\\qj'; break; } if ($this->_font) { $content .= $this->_font->getContent($this->_table->getRtf()); } $content .= parent::getContent() . '\\cell \\pard }' . "\r\n"; return $content; }
/** * constructor of cell * * @param PHPRtfLite_Table $table table instance * @param integer $rowIndex row index for cell in table * @param integer $columnIndex column index for cell in table */ public function __construct(PHPRtfLite_Table $table, $rowIndex, $columnIndex) { $this->_table = $table; $this->_rowIndex = $rowIndex; $this->_columnIndex = $columnIndex; $this->_rtf = $table->getRtf(); }