Skip to content

Commit 841bc2a

Browse files
author
Bas-Jan 't Jong
committed
Revert "Fixed a bug in TextBox; addText to a TextBox was treated 'withoutP'. This is not the expected behaviour"
This reverts commit ade740b.
1 parent ade740b commit 841bc2a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/PhpWord/Writer/Word2007/Element/TextBox.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ public function write()
5757
$margins = implode(', ', $tbxStyle->getInnerMargin());
5858
$this->xmlWriter->writeAttribute('inset', $margins);
5959
$this->xmlWriter->startElement('w:txbxContent');
60+
$this->xmlWriter->startElement('w:p');
6061
$this->parentWriter->writeContainerElements($this->xmlWriter, $this->element);
62+
$this->xmlWriter->endElement(); // w:p
6163
$this->xmlWriter->endElement(); // w:txbxContent
6264
$this->xmlWriter->endElement(); // v: textbox
6365
$styleWriter->writeW10Wrap();

src/PhpWord/Writer/Word2007/Part/AbstractPart.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function writeContainerElements(XMLWriter $xmlWriter, AbstractElement $co
110110

111111
// Loop through elements
112112
$elements = $container->getElements();
113-
$withoutP = in_array($containerName, array('TextRun', 'Footnote', 'Endnote')) ? true : false;
113+
$withoutP = in_array($containerName, array('TextRun', 'Footnote', 'Endnote', 'TextBox')) ? true : false;
114114
if (count($elements) > 0) {
115115
foreach ($elements as $element) {
116116
if ($element instanceof AbstractElement) {

0 commit comments

Comments
 (0)