Replies: 2   Views: 3322
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 medikin  · 31-03-2016 - 20:25


We are an existing client and potentially an upgrade client, but
before we shell out $199 for the upgrade we need to know if a
particular problem / bug was resolved.


The problem is that when saving documents that have a header, extra
carriage returns are added. This makes the software unusable and we
want to know if it is fixed. In that case we will gladly upgrade. If
you need more details on exactly how the problem occurs we would be
glad to provide that info.

Posted by admin  · 01-04-2016 - 06:45


Please send to contact[at] the most simple script that illustrates the issue (this is without doing external connections such as databases or webservices) and we'll check it. Also, please attach the DOCX output after you run this same script.


Posted by admin  · 05-04-2016 - 08:00

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:
        $docx->importStyles($file_path."/BaseHeaderTemplate.docx", 'replace');
    catch(Exception $e){


The importHeadersAndFooters method doesn't import external styles.