Skip to content

Commit 3f2b90c

Browse files
committed
Add nowrap parameter for table cell
1 parent f195d28 commit 3f2b90c

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/PhpWord/Reader/Word2007/AbstractPart.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,7 @@ private function readCellStyle(XMLReader $xmlReader, DOMElement $domNode)
560560
'gridSpan' => [self::READ_VALUE, 'w:gridSpan'],
561561
'vMerge' => [self::READ_VALUE, 'w:vMerge', null, null, 'continue'],
562562
'bgColor' => [self::READ_VALUE, 'w:shd', 'w:fill'],
563+
'noWrap' => [self::READ_VALUE, 'w:noWrap', null, null, true]
563564
];
564565

565566
return $this->readStyleDefs($xmlReader, $domNode, $styleDefs);

src/PhpWord/Style/Cell.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ class Cell extends Border
118118
*/
119119
private $unit = TblWidth::TWIP;
120120

121+
/**
122+
* Prevent text from wrapping in the cell
123+
*
124+
* @var bool
125+
*/
126+
private $noWrap;
127+
121128
/**
122129
* Get vertical align.
123130
*
@@ -312,4 +319,26 @@ public function setUnit($value)
312319

313320
return $this;
314321
}
322+
323+
/**
324+
* Set noWrap
325+
*
326+
* @param $value
327+
*/
328+
public function setNoWrap($value)
329+
{
330+
$this->noWrap = $this->setBoolVal($value, true);
331+
332+
return $this;
333+
}
334+
335+
/**
336+
* Get noWrap
337+
*
338+
* @return bool
339+
*/
340+
public function getNoWrap()
341+
{
342+
return $this->noWrap;
343+
}
315344
}

0 commit comments

Comments
 (0)