示例#1
1
 public function assign($field, $value = null)
 {
     $this->info[$field] = $value;
     if (!is_array($value)) {
         parent::setValue($field, $value);
     } else {
         parent::setValueList($field, $value);
     }
 }
 /**
  * add body rows
  *
  * @param Tinebase_Record_RecordSet $records
  */
 public function processIteration($_records)
 {
     $record = $_records->getFirstRecord();
     $converter = Tinebase_Convert_Factory::factory($record);
     $resolved = $converter->fromTine20Model($record);
     foreach ($this->_config->properties->prop as $prop) {
         $property = (string) $prop;
         // @TODO: remove the utf8_decode here when PHPWord_Template does not convert to utf8 anymore.
         //        the htmlspecialchars shouldn't be required, this should have been done by the PHPWord Library
         $this->_docTemplate->setValue($property, isset($resolved[$property]) ? utf8_decode(htmlspecialchars($resolved[$property])) : '');
     }
 }
示例#3
0
 public function test_phpdoc_template_replace_image()
 {
     $ret = copy($this->in . '/Templatenke4.docx', $this->out . '/test_template_replace_image.docx');
     $this->assertTrue($ret);
     $PHPWord = new PHPWord_Template($this->out . '/test_template_replace_image.docx');
     $ret = $PHPWord->remplace_image('image2.png', $this->in . '/first-image1.png');
     $this->assertTrue($ret);
     /* vérifi*/
     $ret = $PHPWord->remplace_image('image3.jpg', $this->in . '/first-image2.jpg');
     $this->assertTrue($ret);
     /* Test des messages d'erreur */
     $ret = $PHPWord->remplace_image('imageTOTO.jpg', $this->in . '/first-image2.jpg');
     $this->assertStringStartsWith('RI', $ret);
     $ret = $PHPWord->remplace_image('image2.png', $this->in . '/firstTOTO-image2.jpg');
     $this->assertStringStartsWith('RI', $ret);
     $getImagesize = $PHPWord->getImageSize('image2.png');
     Zend_Debug::dump($getImagesize);
     $this->assertEquals($getImagesize[0], 529);
     $this->assertEquals($getImagesize[1], 487);
     $PHPWord->save($this->out . '/test_template_replace_image.docx');
 }