/** * Create a new TableFull Font */ public function __construct($styleTable = null, $styleFirstRow = null, $styleLastRow = null) { if (!is_null($styleFirstRow) && is_array($styleFirstRow)) { $this->_firstRow = clone $this; unset($this->_firstRow->_firstRow); unset($this->_firstRow->_cellMarginBottom); unset($this->_firstRow->_cellMarginTop); unset($this->_firstRow->_cellMarginLeft); unset($this->_firstRow->_cellMarginRight); unset($this->_firstRow->_borderInsideVColor); unset($this->_firstRow->_borderInsideVSize); unset($this->_firstRow->_borderInsideHColor); unset($this->_firstRow->_borderInsideHSize); unset($this->_firstRow->_alignMent); unset($this->_firstRow->_tableIndent); foreach ($styleFirstRow as $key => $value) { if (substr($key, 0, 1) != '_') { $key = '_' . $key; } $this->_firstRow->setStyleValue($key, $value); } } if (!is_null($styleTable) && is_array($styleTable)) { foreach ($styleTable as $key => $value) { if (substr($key, 0, 1) != '_') { $key = '_' . $key; } $this->setStyleValue($key, $value); } } }
/** * Create a new table * * @param string $insideOf * @param int $pCount * @param mixed $style */ public function __construct($insideOf, $pCount, $style = null) { $this->_insideOf = $insideOf; $this->_pCount = $pCount; if (!is_null($style)) { if (is_array($style)) { $this->_style = new PHPWord_Style_Table(); foreach ($style as $key => $value) { if (substr($key, 0, 1) != '_') { $key = '_' . $key; } $this->_style->setStyleValue($key, $value); } } else { $this->_style = $style; } } }
/** * Create a new table * * @param string $insideOf * @param int $pCount * @param mixed $style */ public function __construct($insideOf, $pCount, $style = null) { $this->_insideOf = $insideOf; $this->_pCount = $pCount; if (is_null($style)) { return; } if (!is_array($style)) { $this->_style = $style; return; } require_once 'Document/Word/Writer/Style/Table.php'; $this->_style = new Document_Word_Writer_Style_Table(); foreach ($style as $key => $value) { if (substr($key, 0, 1) != '_') { $key = '_' . $key; } $this->_style->setStyleValue($key, $value); } }
protected function _writeTableStyle(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Style_Table $style = null) { $margins = $style->getCellMargin(); $mTop = !is_null($margins[0]) ? true : false; $mLeft = !is_null($margins[1]) ? true : false; $mRight = !is_null($margins[2]) ? true : false; $mBottom = !is_null($margins[3]) ? true : false; if ($mTop || $mLeft || $mRight || $mBottom) { $objWriter->startElement('w:tblPr'); $objWriter->startElement('w:tblCellMar'); if ($mTop) { $objWriter->startElement('w:top'); $objWriter->writeAttribute('w:w', $margins[0]); $objWriter->writeAttribute('w:type', 'dxa'); $objWriter->endElement(); } if ($mLeft) { $objWriter->startElement('w:left'); $objWriter->writeAttribute('w:w', $margins[1]); $objWriter->writeAttribute('w:type', 'dxa'); $objWriter->endElement(); } if ($mRight) { $objWriter->startElement('w:right'); $objWriter->writeAttribute('w:w', $margins[2]); $objWriter->writeAttribute('w:type', 'dxa'); $objWriter->endElement(); } if ($mBottom) { $objWriter->startElement('w:bottom'); $objWriter->writeAttribute('w:w', $margins[3]); $objWriter->writeAttribute('w:type', 'dxa'); $objWriter->endElement(); } $objWriter->endElement(); $objWriter->endElement(); } }