setText() public method

public setText ( string $text = '' ) : Comment
$text string
return Comment
Esempio n. 1
0
 public function testGetSetText()
 {
     $expectedText = 'AABBCCDD';
     $object = new Comment();
     $this->assertNull($object->getText());
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Comment', $object->setText($expectedText));
     $this->assertEquals($expectedText, $object->getText());
 }
Esempio n. 2
0
 public function testComment()
 {
     $expectedName = 'Name';
     $expectedText = 'Text';
     $oAuthor = new Comment\Author();
     $oAuthor->setName($expectedName);
     $oComment = new Comment();
     $oComment->setAuthor($oAuthor);
     $oComment->setText($expectedText);
     $this->oPresentation->getActiveSlide()->addShape($oComment);
     $pres = TestHelperDOCX::getDocument($this->oPresentation, 'ODPresentation');
     $element = '/office:document-content';
     $this->assertTrue($pres->elementExists($element, 'content.xml'));
     $this->assertTrue($pres->attributeElementExists($element, 'xmlns:officeooo', 'content.xml'));
     $element = '/office:document-content/office:body/office:presentation/draw:page/officeooo:annotation';
     $this->assertTrue($pres->elementExists($element, 'content.xml'));
     $element = '/office:document-content/office:body/office:presentation/draw:page/officeooo:annotation/dc:creator';
     $this->assertTrue($pres->elementExists($element, 'content.xml'));
     $this->assertEquals($expectedName, $pres->getElement($element, 'content.xml')->nodeValue);
     $element = '/office:document-content/office:body/office:presentation/draw:page/officeooo:annotation/text:p';
     $this->assertTrue($pres->elementExists($element, 'content.xml'));
     $this->assertEquals($expectedText, $pres->getElement($element, 'content.xml')->nodeValue);
 }