Replies: 2   Views: 1070
Exception on importstyles() with version 10.0, works in 9.5
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 dan_brokerbusiness  · 10-09-2020 - 01:01


we are getting the exception "DOMDocument::loadXML(): Empty string supplied as input" (see when using importStyles with 'replace' as second parameter and even the most simple word document (newly created MS Word with only 1 Word and a style applied). 

It works when the 'merge' param is used instead of 'replace'.
It works when using phpdocx version 9.5, but fails in 10.0.

$docx = new CreateDocx();
$docx->importStyles(resource_path('word/simple.docx'), 'replace');

Seems to be a bug?


Posted by admin  · 10-09-2020 - 06:54


You are right, there was a minor bug in the importStyles method. All phpdocx 10 packages (Basic, Advanced and Premium) has been fixed with the correction. If you don't want to download the new package, please edit CreateDocx.php (classes folder in the classic package or Classes/Phpdocx/Create in the namespaces package), and in the importStyles method replace the following line:




We apologise for any inconvenience caused


Posted by dan_brokerbusiness  · 11-09-2020 - 04:02

After downloading the updated package its working now. Thanks!