Esempio n. 1
0
 /**
  *
  * @param DOMElment $table
  * @param PHPWord_Section_Table $mainTable
  * @return boolean 
  */
 protected function _addTableHeader($table, $mainTable)
 {
     $thead = $table->getElementsByTagName('thead');
     if (empty($thead->length)) {
         return false;
     }
     $thead = $thead->item(0);
     $rows = $thead->getElementsByTagName('tr');
     foreach ($rows as $row) {
         $mainTable->addRow();
         $cells = $row->getElementsByTagName('th');
         $headerCellStyle = array('bgColor' => 'FCFCFC');
         $fontHeaderStyle = array('bold' => 'Bold', 'color' => '545151');
         // Insert each row cell
         foreach ($cells as $cell) {
             $this->_addCell($cell, $mainTable, $headerCellStyle, $fontHeaderStyle, array());
         }
     }
 }
Esempio n. 2
0
 /**
  *
  * @param DOMElment $table
  * @return boolean 
  */
 protected function _addTableHeader($table)
 {
     $thead = $table->getElementsByTagName('thead');
     if (empty($thead->length)) {
         return false;
     }
     $thead = $thead->item(0);
     $rows = $thead->getElementsByTagName('tr');
     $this->_currentRow = $this->_startRow;
     foreach ($rows as $row) {
         $cells = $row->getElementsByTagName('th');
         $this->_currentCell = $this->_startCol;
         // Insert each row cell
         foreach ($cells as $cell) {
             $this->_addCell($cell);
         }
         $this->_currentRow++;
     }
     $range = array(PHPExcel_Cell::stringFromColumnIndex($this->_startCol) . $this->_startRow, PHPExcel_Cell::stringFromColumnIndex($this->_currentCell - 1) . ($this->_currentRow - 1));
     $range = implode(':', $range);
     $this->_mainSheet->setSharedStyle($this->_styles['table_header'], $range);
 }