From a610c34a1889818f2e97fe6ed7f6245e44465337 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Sun, 15 Dec 2013 13:42:36 +0100 Subject: [PATCH] Word2007 : Add rowspan and colspan to cells --- Classes/PHPWord/Style/Cell.php | 35 +++++++++++++++++++++--- Classes/PHPWord/Writer/Word2007/Base.php | 13 +++++++++ changelog.txt | 1 + 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/Classes/PHPWord/Style/Cell.php b/Classes/PHPWord/Style/Cell.php index a09b3067..090ff7b4 100644 --- a/Classes/PHPWord/Style/Cell.php +++ b/Classes/PHPWord/Style/Cell.php @@ -121,7 +121,20 @@ class PHPWord_Style_Cell { * @var string */ private $_defaultBorderColor; - + + /** + * colspan + * + * @var integer + */ + private $_gridSpan = NULL; + + /** + * rowspan + * + * @var integer + */ + private $_vMerge = NULL; /** * Create a new Cell Style @@ -233,7 +246,6 @@ class PHPWord_Style_Cell { return $this->_borderTopColor; } - public function setBorderLeftSize($pValue = null) { $this->_borderLeftSize = $pValue; } @@ -249,8 +261,7 @@ class PHPWord_Style_Cell { public function getBorderLeftColor() { return $this->_borderLeftColor; } - - + public function setBorderRightSize($pValue = null) { $this->_borderRightSize = $pValue; } @@ -287,5 +298,21 @@ class PHPWord_Style_Cell { public function getDefaultBorderColor() { return $this->_defaultBorderColor; } + + public function setGridSpan($pValue = null) { + $this->_gridSpan = $pValue; + } + + public function getGridSpan() { + return $this->_gridSpan; + } + + public function setVMerge($pValue = null) { + $this->_vMerge = $pValue; + } + + public function getVMerge() { + return $this->_vMerge; + } } ?> \ No newline at end of file diff --git a/Classes/PHPWord/Writer/Word2007/Base.php b/Classes/PHPWord/Writer/Word2007/Base.php index c03342ea..3800148e 100644 --- a/Classes/PHPWord/Writer/Word2007/Base.php +++ b/Classes/PHPWord/Writer/Word2007/Base.php @@ -586,6 +586,19 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart { $objWriter->endElement(); } } + $gridSpan = $style->getGridSpan(); + if(!is_null($gridSpan)) { + $objWriter->startElement('w:gridSpan'); + $objWriter->writeAttribute('w:val', $gridSpan); + $objWriter->endElement(); + } + + $vMerge = $style->getVMerge(); + if(!is_null($vMerge)) { + $objWriter->startElement('w:vMerge'); + $objWriter->writeAttribute('w:val', $vMerge); + $objWriter->endElement(); + } } protected function _writeImage(PHPWord_Shared_XMLWriter $objWriter = null, $image) { diff --git a/changelog.txt b/changelog.txt index 028aea1c..fa976217 100644 --- a/changelog.txt +++ b/changelog.txt @@ -26,6 +26,7 @@ Fixed in branch for release 0.7 : - Bugfix: (RomanSyroeshko) GH-34 - PHPWord_Shared_String.IsUTF8 returns FALSE for Cyrillic UTF-8 input - Feature: (Progi1984) GH-1 - Implement RTF Writer - Feature: (Progi1984) GH-2 - Implement ODT Writer +- Feature: (kaystrobach) - Word2007 : Add rowspan and colspan to cells - General: (MarkBaker) - Add superscript/subscript styling in Excel2007 Writer - General: (deds) - add indentation support to paragraphs - General: (Progi1984) GH-27 - Support for Composer