Add plain text SDT type
This commit is contained in:
parent
56ca30ab95
commit
a5ec49d99d
@ -90,7 +90,7 @@ class SDT extends Text
|
|||||||
*/
|
*/
|
||||||
public function setType($value)
|
public function setType($value)
|
||||||
{
|
{
|
||||||
$enum = array('comboBox', 'dropDownList', 'date');
|
$enum = array('plainText', 'comboBox', 'dropDownList', 'date');
|
||||||
$this->type = $this->setEnumVal($value, $enum, 'comboBox');
|
$this->type = $this->setEnumVal($value, $enum, 'comboBox');
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
|||||||
@ -73,6 +73,18 @@ class SDT extends Text
|
|||||||
$this->endElementP(); // w:p
|
$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.
|
* Write combo box.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -29,8 +29,8 @@ class SDTTest extends \PHPUnit\Framework\TestCase
|
|||||||
*/
|
*/
|
||||||
public function testConstruct()
|
public function testConstruct()
|
||||||
{
|
{
|
||||||
$types = array('comboBox', 'dropDownList', 'date');
|
$types = array('plainText', 'comboBox', 'dropDownList', 'date');
|
||||||
$type = $types[rand(0, 2)];
|
$type = $types[rand(0, 3)];
|
||||||
$value = rand(0, 100);
|
$value = rand(0, 100);
|
||||||
$alias = 'alias';
|
$alias = 'alias';
|
||||||
$tag = 'my_tag';
|
$tag = 'my_tag';
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user