diff --git a/src/PhpWord/Element/SDT.php b/src/PhpWord/Element/SDT.php index a866d1bd..5548f768 100644 --- a/src/PhpWord/Element/SDT.php +++ b/src/PhpWord/Element/SDT.php @@ -90,7 +90,7 @@ class SDT extends Text */ public function setType($value) { - $enum = array('comboBox', 'dropDownList', 'date'); + $enum = array('plainText', 'comboBox', 'dropDownList', 'date'); $this->type = $this->setEnumVal($value, $enum, 'comboBox'); return $this; diff --git a/src/PhpWord/Writer/Word2007/Element/SDT.php b/src/PhpWord/Writer/Word2007/Element/SDT.php index 21020a0f..fc1540b9 100644 --- a/src/PhpWord/Writer/Word2007/Element/SDT.php +++ b/src/PhpWord/Writer/Word2007/Element/SDT.php @@ -73,6 +73,18 @@ class SDT extends Text $this->endElementP(); // w:p } + /** + * Write text. + * + * @see http://www.datypic.com/sc/ooxml/t-w_CT_SdtText.html + * @param \PhpOffice\Common\XMLWriter $xmlWriter + * @param \PhpOffice\PhpWord\Element\SDT $element + */ + private function writePlainText(XMLWriter $xmlWriter, SDTElement $element) + { + $xmlWriter->startElement("w:text"); + $xmlWriter->endElement(); // w:{$type} + } /** * Write combo box. * diff --git a/tests/PhpWord/Element/SDTTest.php b/tests/PhpWord/Element/SDTTest.php index 6e40bae0..2328dd76 100644 --- a/tests/PhpWord/Element/SDTTest.php +++ b/tests/PhpWord/Element/SDTTest.php @@ -29,8 +29,8 @@ class SDTTest extends \PHPUnit\Framework\TestCase */ public function testConstruct() { - $types = array('comboBox', 'dropDownList', 'date'); - $type = $types[rand(0, 2)]; + $types = array('plainText', 'comboBox', 'dropDownList', 'date'); + $type = $types[rand(0, 3)]; $value = rand(0, 100); $alias = 'alias'; $tag = 'my_tag';