From 841bc2ac69ac24bcec92f6c6d679526a6955526b Mon Sep 17 00:00:00 2001 From: Bas-Jan 't Jong Date: Thu, 8 May 2014 21:41:30 +0200 Subject: [PATCH] Revert "Fixed a bug in TextBox; addText to a TextBox was treated 'withoutP'. This is not the expected behaviour" This reverts commit ade740b562793670155d2c081de97265410abdcc. --- src/PhpWord/Writer/Word2007/Element/TextBox.php | 2 ++ src/PhpWord/Writer/Word2007/Part/AbstractPart.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/PhpWord/Writer/Word2007/Element/TextBox.php b/src/PhpWord/Writer/Word2007/Element/TextBox.php index b732ffab..fd1683ae 100644 --- a/src/PhpWord/Writer/Word2007/Element/TextBox.php +++ b/src/PhpWord/Writer/Word2007/Element/TextBox.php @@ -57,7 +57,9 @@ class TextBox extends Element $margins = implode(', ', $tbxStyle->getInnerMargin()); $this->xmlWriter->writeAttribute('inset', $margins); $this->xmlWriter->startElement('w:txbxContent'); + $this->xmlWriter->startElement('w:p'); $this->parentWriter->writeContainerElements($this->xmlWriter, $this->element); + $this->xmlWriter->endElement(); // w:p $this->xmlWriter->endElement(); // w:txbxContent $this->xmlWriter->endElement(); // v: textbox $styleWriter->writeW10Wrap(); diff --git a/src/PhpWord/Writer/Word2007/Part/AbstractPart.php b/src/PhpWord/Writer/Word2007/Part/AbstractPart.php index b09613a6..d1717e9b 100644 --- a/src/PhpWord/Writer/Word2007/Part/AbstractPart.php +++ b/src/PhpWord/Writer/Word2007/Part/AbstractPart.php @@ -110,7 +110,7 @@ abstract class AbstractPart // Loop through elements $elements = $container->getElements(); - $withoutP = in_array($containerName, array('TextRun', 'Footnote', 'Endnote')) ? true : false; + $withoutP = in_array($containerName, array('TextRun', 'Footnote', 'Endnote', 'TextBox')) ? true : false; if (count($elements) > 0) { foreach ($elements as $element) { if ($element instanceof AbstractElement) {