From ade740b562793670155d2c081de97265410abdcc Mon Sep 17 00:00:00 2001 From: Bas-Jan 't Jong Date: Thu, 8 May 2014 21:38:54 +0200 Subject: [PATCH 1/3] Fixed a bug in TextBox; addText to a TextBox was treated 'withoutP'. This is not the expected behaviour --- src/PhpWord/Writer/Word2007/Element/TextBox.php | 2 -- src/PhpWord/Writer/Word2007/Part/AbstractPart.php | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/PhpWord/Writer/Word2007/Element/TextBox.php b/src/PhpWord/Writer/Word2007/Element/TextBox.php index fd1683ae..b732ffab 100644 --- a/src/PhpWord/Writer/Word2007/Element/TextBox.php +++ b/src/PhpWord/Writer/Word2007/Element/TextBox.php @@ -57,9 +57,7 @@ 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 d1717e9b..b09613a6 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', 'TextBox')) ? true : false; + $withoutP = in_array($containerName, array('TextRun', 'Footnote', 'Endnote')) ? true : false; if (count($elements) > 0) { foreach ($elements as $element) { if ($element instanceof AbstractElement) { 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 2/3] 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) { From 474d36040a6578fdb2c9194f2a816ed07d649a3b Mon Sep 17 00:00:00 2001 From: Bas-Jan 't Jong Date: Thu, 8 May 2014 21:43:55 +0200 Subject: [PATCH 3/3] Fixed a bug in TextBox; addText to a TextBox was treated 'withoutP'. This is not the expected behaviour --- src/PhpWord/Writer/Word2007/Element/TextBox.php | 2 -- src/PhpWord/Writer/Word2007/Part/AbstractPart.php | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/PhpWord/Writer/Word2007/Element/TextBox.php b/src/PhpWord/Writer/Word2007/Element/TextBox.php index fd1683ae..b732ffab 100644 --- a/src/PhpWord/Writer/Word2007/Element/TextBox.php +++ b/src/PhpWord/Writer/Word2007/Element/TextBox.php @@ -57,9 +57,7 @@ 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 d1717e9b..b09613a6 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', 'TextBox')) ? true : false; + $withoutP = in_array($containerName, array('TextRun', 'Footnote', 'Endnote')) ? true : false; if (count($elements) > 0) { foreach ($elements as $element) { if ($element instanceof AbstractElement) {