Forum


Replies: 2   Views: 3307
Extra spaces in header/footer generated documents
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 admin  · 05-04-2016 - 08:00

Hello,
Thanks for your DOCX samples. We have checked it and the problem is that the headers in your base document has external styles, so you just need to import them using the importStyles method:
 
if(file_exists($file_path.'/BaseHeaderTemplate.docx')){
    try{
        $docx->importHeadersAndFooters($file_path."/BaseHeaderTemplate.docx");
        $docx->importStyles($file_path."/BaseHeaderTemplate.docx", 'replace');
    }
    catch(Exception $e){
        print_r($e->getMessage());
    }
}

 

The importHeadersAndFooters method doesn't import external styles. 
Regards.