Forum


Replies: 1   Views: 1431
Errorexception : phpdocx\elements\createproperties::createproperties(): unterminated entity
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 vpratfr  · 26-07-2020 - 07:42

// Following results in Exception
// ErrorException : Phpdocx\Elements\CreateProperties::createProperties(): unterminated entity 
// reference  co.

        $docx = new CreateDocx();
        $docx->addProperties([
            'title'          => "John & co.",
            'creator'        => "John & co.",
            'lastModifiedBy' => "John & co.",
            'description'    => "John & co.",
        ]);
        $docx->createDocx("test.docx");

// Following results in a warning when opening the Word document (some unreadable content has been 
// found...). If we recover the document it is fine, but of course we don't want to give such a 
// document to our customers

        $docx = new CreateDocx();
        $docx->addProperties([
            'title'          => htmlentities("John & co."),
            'creator'        => htmlentities("John & co."),
            'lastModifiedBy' => htmlentities("John & co."),
            'description'    => htmlentities("John & co."),
        ]);
        $docx->createDocx("test.docx");

The above code causes issues, and we could not find a way to get around it. How do we put special characters in document properties?