Forum


Replies: 4   Views: 1330
Importstyles issue
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 pwctechnicalsecurity  · 29-03-2021 - 11:28

Hi,

I am encountering an issue with the importStyles function:

ErrorException

Undefined variable $name

Classes/Phpdocx/Create/CreateDocx.php:7196

I am following the simple example as outlined on https://www.phpdocx.com/api-documentation/layout-and-general/import-styles-from-a-Word-document-with-PHP.

The source DocX holds the paragraph styles: MatrixBullet, MatrixIndicator and MatrixTitle - parseStyles showed that both the ID and name are identical. I have tried both:

$docx->importStyles(app_path('Segments/_Default/Matrix/Matrix.docx'), 'merge', array('pStyle' => 'MatrixBullet'));

as well as:

$docx->importStyles(app_path('Segments/_Default/Matrix/Matrix.docx'), 'merge', array('MatrixBullet'));

 Both result in the abovementioned error.

Any suggestions?