Skip to content

Commit a610c34

Browse files
committed
Word2007 : Add rowspan and colspan to cells
1 parent 0d19d57 commit a610c34

File tree

3 files changed

+45
-4
lines changed

3 files changed

+45
-4
lines changed

Classes/PHPWord/Style/Cell.php

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,20 @@ class PHPWord_Style_Cell {
121121
* @var string
122122
*/
123123
private $_defaultBorderColor;
124-
124+
125+
/**
126+
* colspan
127+
*
128+
* @var integer
129+
*/
130+
private $_gridSpan = NULL;
131+
132+
/**
133+
* rowspan
134+
*
135+
* @var integer
136+
*/
137+
private $_vMerge = NULL;
125138

126139
/**
127140
* Create a new Cell Style
@@ -233,7 +246,6 @@ public function getBorderTopColor() {
233246
return $this->_borderTopColor;
234247
}
235248

236-
237249
public function setBorderLeftSize($pValue = null) {
238250
$this->_borderLeftSize = $pValue;
239251
}
@@ -249,8 +261,7 @@ public function setBorderLeftColor($pValue = null) {
249261
public function getBorderLeftColor() {
250262
return $this->_borderLeftColor;
251263
}
252-
253-
264+
254265
public function setBorderRightSize($pValue = null) {
255266
$this->_borderRightSize = $pValue;
256267
}
@@ -287,5 +298,21 @@ public function getBorderBottomColor() {
287298
public function getDefaultBorderColor() {
288299
return $this->_defaultBorderColor;
289300
}
301+
302+
public function setGridSpan($pValue = null) {
303+
$this->_gridSpan = $pValue;
304+
}
305+
306+
public function getGridSpan() {
307+
return $this->_gridSpan;
308+
}
309+
310+
public function setVMerge($pValue = null) {
311+
$this->_vMerge = $pValue;
312+
}
313+
314+
public function getVMerge() {
315+
return $this->_vMerge;
316+
}
290317
}
291318
?>

Classes/PHPWord/Writer/Word2007/Base.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,19 @@ protected function _writeCellStyle(PHPWord_Shared_XMLWriter $objWriter = null, P
586586
$objWriter->endElement();
587587
}
588588
}
589+
$gridSpan = $style->getGridSpan();
590+
if(!is_null($gridSpan)) {
591+
$objWriter->startElement('w:gridSpan');
592+
$objWriter->writeAttribute('w:val', $gridSpan);
593+
$objWriter->endElement();
594+
}
595+
596+
$vMerge = $style->getVMerge();
597+
if(!is_null($vMerge)) {
598+
$objWriter->startElement('w:vMerge');
599+
$objWriter->writeAttribute('w:val', $vMerge);
600+
$objWriter->endElement();
601+
}
589602
}
590603

591604
protected function _writeImage(PHPWord_Shared_XMLWriter $objWriter = null, $image) {

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Fixed in branch for release 0.7 :
2626
- Bugfix: (RomanSyroeshko) GH-34 - PHPWord_Shared_String.IsUTF8 returns FALSE for Cyrillic UTF-8 input
2727
- Feature: (Progi1984) GH-1 - Implement RTF Writer
2828
- Feature: (Progi1984) GH-2 - Implement ODT Writer
29+
- Feature: (kaystrobach) - Word2007 : Add rowspan and colspan to cells
2930
- General: (MarkBaker) - Add superscript/subscript styling in Excel2007 Writer
3031
- General: (deds) - add indentation support to paragraphs
3132
- General: (Progi1984) GH-27 - Support for Composer

0 commit comments

Comments
 (0)