Forum


Replies: 16   Views: 4357
Header and footer not showing
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by Simco uwkm  · 20-12-2017 - 10:25

now i'm totaly lost, just have this code in my extension:

<?php
namespace UWKM\UwkmOffer\Controller;

class OfferController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
{

        public function submitAction()
        {

                require_once(__DIR__ . '/../../Lib/Classes/Phpdocx/AutoLoader.inc');
                \Phpdocx\AutoLoader::load();

                $docx = new \Phpdocx\Create\CreateDocx();
                $footerImageOptions = array(
                        'src' => __DIR__ . '/../../Resources/Public/Images/simco_footer.png', 
                        'dpi'=>300,
                );
                
                $footerImage = new \Phpdocx\Elements\WordFragment($docx, 'defaultFooter');
                $footerImage->addImage($footerImageOptions);
                
                $headerElements = new \Phpdocx\Elements\WordFragment($docx, 'headers');
                
                $headView = $this->offerRepository->getTemplateHtml('Offer', 'header');
                
                $headView->assign('image', __DIR__ .'/../../Resources/Public/Images/simco_header2.png');
                $headView->assign('addressInfo', 'Simco-ION
Aalsvoort 74
7241 MB Lochem
The Netherlands
+31 (0)753 288378
+31 (0)573 288390
cs@simco-ion.nl');

                $headerElements->embedHTML($headView->render(), array('downloadImages'=>true));
                $docx->addHeader(array('first'=>$headerElements, 'default' => $headerElements));
                $docx->addFooter(array('first'=>$footerImage,'default' => $footerImage));
                $docx->createDocxAndDownload(__DIR__.'/document.docx');
        }
}


wel resulting docx is without images here. is it bugging due script using namespace too ?