Forum


Replies: 3   Views: 86
Php undefined array merging documents

Posted by fairshareitservices  · 22-02-2025 - 17:59

Two word document generate through html template. In one document jpg images are present. When these two document get merged using mergeDocx funtion of MultiMerge. Showing error ---- 

Warning: Undefined array key "" in D:\laravel\prj\prj-php-word-docx\phpdocx-premium\classes\MultiMerge.php on line 2097
PHP Warning:  Undefined array key "" in D:\laravel\prj\prj-php-word-docx\phpdocx-premium\classes\MultiMerge.php on line 2117

What is this error about?? 

When I try to open merged document it gives me message "Word Found unreadable content in file_nameXXX.docx. Do you want to recover content from the document?" . File get open but Instead of file real name it shows Document1.

 

Posted by admin  · 22-02-2025 - 18:46

Hello,

We need to check the DOCX documents you are merging. Please send them to contact[at]phpdocx.com.

Regards.

Posted by fairshareitservices  · 23-02-2025 - 09:09

mail subject - PHP undefined array merging documents

Kindly check . 2 files which we are merging and 1 merged file is attached with email. 

Posted by admin  · 23-02-2025 - 10:09

Hello,

UPDATE: phpdocx 16 adds support to remote images when merging documents.

Thank you for providing the DOCX documents and highlighting the issue you encountered. The error arises due to missing support for remote images during the document merge process.

To resolve this, the simplest approach is to embed the images directly when generating the documents, rather than using remote URLs. When utilizing embedHTML and replaceVariableByHTML, ensure that the downloadImages option is set to true (which is the default value). It appears that this option may currently be set to false in your implementation.

Furthermore, we have incorporated support for remote images in the current testing branch of the MultiMerge class, which will be included in the next stable release of phpdocx.

Regards.