getColumnsCount() public method

gets number of columns in table
public getColumnsCount ( ) : integer
return integer
Beispiel #1
0
 /**
  * renders rtf code for cell
  */
 public function render()
 {
     $stream = $this->_rtf->getWriter();
     $stream->write("\r\n");
     // renders container elements
     parent::render();
     $containerElements = $this->getElements();
     $numOfContainerElements = count($containerElements);
     if ($this->_table->isNestedTable()) {
         // if last container element is not a nested table, close cell
         if ($numOfContainerElements == 0 || !$containerElements[$numOfContainerElements - 1] instanceof PHPRtfLite_Table_Nested) {
             $stream->write('{\\nestcell{\\nonesttables\\par}\\pard}' . "\r\n");
             // if last cell of row, close row
             if ($this->getColumnIndex() == $this->_table->getColumnsCount()) {
                 $stream->write('{\\*\\nesttableprops ');
                 $row = $this->_table->getRow($this->_rowIndex);
                 $this->_table->renderRowDefinition($row);
                 $stream->write('\\nestrow}');
             }
         }
     } else {
         if ($numOfContainerElements > 0 && $containerElements[$numOfContainerElements - 1] instanceof PHPRtfLite_Table_Nested) {
             $stream->write('\\intbl\\itap1\\~');
         }
         // closing tag for cell definition
         $stream->write('\\cell');
     }
     $stream->write("\r\n");
 }
Beispiel #2
0
 /**
  * test addColumn
  * @depends testAddColumnList
  */
 public function testAddColumn(PHPRtfLite_Table $table)
 {
     $table->addColumn(7);
     $this->assertEquals(3, $table->getColumnsCount());
     return $table;
 }