/** * sets border to a cell * * @param PHPRtfLite_Border $border */ public function setBorder(PHPRtfLite_Border $border) { $borderFormatTop = $border->getBorderTop(); $borderFormatBottom = $border->getBorderBottom(); $borderFormatLeft = $border->getBorderLeft(); $borderFormatRight = $border->getBorderRight(); if ($this->_border === null) { $this->_border = new PHPRtfLite_Border($this->_rtf); } if ($borderFormatLeft) { $this->_border->setBorderLeft($borderFormatLeft); } if ($borderFormatRight) { $this->_border->setBorderRight($borderFormatRight); } if ($borderFormatTop) { $this->_border->setBorderTop($borderFormatTop); } if ($borderFormatBottom) { $this->_border->setBorderBottom($borderFormatBottom); } if ($borderFormatTop && $this->_table->checkIfCellExists($this->_rowIndex - 1, $this->_columnIndex)) { $this->getBorderForCell($this->_rowIndex - 1, $this->_columnIndex)->setBorderBottom($borderFormatTop); } if ($borderFormatBottom && $this->_table->checkIfCellExists($this->_rowIndex + 1, $this->_columnIndex)) { $this->getBorderForCell($this->_rowIndex + 1, $this->_columnIndex)->setBorderTop($borderFormatBottom); } if ($borderFormatLeft && $this->_table->checkIfCellExists($this->_rowIndex, $this->_columnIndex - 1)) { $this->getBorderForCell($this->_rowIndex, $this->_columnIndex - 1)->setBorderRight($borderFormatLeft); } if ($borderFormatRight && $this->_table->checkIfCellExists($this->_rowIndex, $this->_columnIndex + 1)) { $this->getBorderForCell($this->_rowIndex, $this->_columnIndex + 1)->setBorderLeft($borderFormatRight); } }
/** * tests checkIfCellExists * @depends testCheckIfCellExistsStartIndex */ public function testCheckIfCellExistsOutOfIndex(PHPRtfLite_Table $table) { $this->assertFalse($table->checkIfCellExists(4, 4)); }