Exemplo n.º 1
0
 /**
  * Add a by PHP created Image Element
  * 
  * @param string $link
  * @param mixed $style
  * @return PHPWord_Section_MemoryImage
  */
 public function addMemoryImage($link, $style = null)
 {
     require_once __DIR__ . '/MemoryImage.php';
     $memoryImage = new Document_Word_Writer_Section_MemoryImage($link, $style);
     if (!is_null($memoryImage->getSource())) {
         $rID = Document_Word_Writer_Media::addFooterMediaElement($this->_footerCount, $link, $memoryImage);
         $memoryImage->setRelationId($rID);
         $this->_elementCollection[] = $memoryImage;
         return $memoryImage;
     } else {
         trigger_error('Unsupported image type.');
     }
 }
Exemplo n.º 2
0
Arquivo: Cell.php Projeto: roojs/pear
 /**
  * Add a by PHP created Image Element
  * 
  * @param string $link
  * @param mixed $style
  * @return PHPWord_Section_MemoryImage
  */
 public function addMemoryImage($link, $style = null)
 {
     $memoryImage = new Document_Word_Writer_Section_MemoryImage($link, $style);
     if (!is_null($memoryImage->getSource())) {
         if ($this->_insideOf == 'section') {
             $rID = Document_Word_Writer_Media::addSectionMediaElement($link, 'image', $memoryImage);
         } elseif ($this->_insideOf == 'header') {
             $rID = Document_Word_Writer_Media::addHeaderMediaElement($this->_pCount, $link, $memoryImage);
         } elseif ($this->_insideOf == 'footer') {
             $rID = Document_Word_Writer_Media::addFooterMediaElement($this->_pCount, $link, $memoryImage);
         }
         $memoryImage->setRelationId($rID);
         $this->_elementCollection[] = $memoryImage;
         return $memoryImage;
     } else {
         trigger_error('Unsupported image type.');
     }
 }