Forum


Replies: 4   Views: 3681
Using template in constructor - ignores page margins
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 garethellis36  · 19-02-2014 - 17:16

Hello



I have created a template with a header & footer and with custom page layout including margins. When I insert content into the document and createDocx, the header does not look the same as the template. In addition, the page layout is changed - the margins revert to something that looks more like A4. Here is the code:



        require_once(ROOT . '\\vendors\\phpdocx\\classes\\CreateDocx.inc');



        $docx = new CreateDocx(ROOT . '\\vendors\\phpdocx\\templates\\certificate_tr.docx');    



        //add main body to document

        $docx->addHTML(array('html' => $html));



        $docx->createDocx($filepath . $filename);



Am I doing something wrong?


Posted by garethellis36  · 19-02-2014 - 18:04

Here's the margin & header from the template:



http://i.imgur.com/mUSXm2p.jpg



 



Here's what the output looks like:




Posted by garethellis36  · 19-02-2014 - 18:05

Template:



Output:

Posted by garethellis36  · 19-02-2014 - 18:06

Template: http://i.imgur.com/mUSXm2p.jpg



Output: http://i.imgur.com/LoXyq8K.jpg