diff --git a/Classes/PHPWord/Section/Table.php b/Classes/PHPWord/Section/Table.php index 80126cba..7efdf0b8 100755 --- a/Classes/PHPWord/Section/Table.php +++ b/Classes/PHPWord/Section/Table.php @@ -101,9 +101,9 @@ class PHPWord_Section_Table * @param int $height * @param mixed $style */ - public function addRow($height = null, $style = null) + public function addRow($height = null, $style = null, $hRules = null) { - $row = new PHPWord_Section_Table_Row($this->_insideOf, $this->_pCount, $height, $style); + $row = new PHPWord_Section_Table_Row($this->_insideOf, $this->_pCount, $height, $style, $hRules); $this->_rows[] = $row; return $row; } diff --git a/Classes/PHPWord/Section/Table/Row.php b/Classes/PHPWord/Section/Table/Row.php index dd8ea65c..5b239c89 100644 --- a/Classes/PHPWord/Section/Table/Row.php +++ b/Classes/PHPWord/Section/Table/Row.php @@ -37,7 +37,14 @@ class PHPWord_Section_Table_Row * @var int */ private $_height = null; - + + /** + * Row heightRules + * + * @var array + */ + private $_heightRules = array(); + /** * Row style * @@ -75,11 +82,12 @@ class PHPWord_Section_Table_Row * @param int $height * @param mixed $style */ - public function __construct($insideOf, $pCount, $height = null, $style = null) + public function __construct($insideOf, $pCount, $height = null, $style = null, $hRules = null) { $this->_insideOf = $insideOf; $this->_pCount = $pCount; $this->_height = $height; + $this->_heightRules = $hRules; $this->_style = new PHPWord_Style_Row(); if (!is_null($style)) { @@ -138,4 +146,14 @@ class PHPWord_Section_Table_Row { return $this->_height; } + + /** + * Get all row height rules + * + * @return array + */ + public function getHeightRules() + { + return $this->_heightRules; + } } diff --git a/Classes/PHPWord/Writer/Word2007/Base.php b/Classes/PHPWord/Writer/Word2007/Base.php index 0102979d..57bb7266 100755 --- a/Classes/PHPWord/Writer/Word2007/Base.php +++ b/Classes/PHPWord/Writer/Word2007/Base.php @@ -570,6 +570,7 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart for ($i = 0; $i < $_cRows; $i++) { $row = $_rows[$i]; $height = $row->getHeight(); + $heightRules = $row->getHeightRules(); $rowStyle = $row->getStyle(); $tblHeader = $rowStyle->getTblHeader(); $cantSplit = $rowStyle->getCantSplit(); @@ -580,6 +581,11 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart $objWriter->startElement('w:trPr'); if (!is_null($height)) { $objWriter->startElement('w:trHeight'); + if(!is_null($heightRules)) { + $objWriter->startAttribute('w:hRule'); + $objWriter->text($heightRules); + $objWriter->endAttribute(); + } $objWriter->writeAttribute('w:val', $height); $objWriter->endElement(); }