Skip to content

Adding a value that contains "&" in a template breaks it #51

Closed
@jdespatis

Description

@jdespatis

I'm using the template stuff in order to replace some values, but the following code breaks the template (anything in the template after the & symbol is not shown):

        $document = $PHPWord->loadTemplate($templatePath);
        $document->setValue('type', "some value & foobar");

I guess the & is a specific character in xml word files, like it can be in html

The workaround I'm currently using is to wrap the value into an htmlspecialchars and all is ok afterwards:

        $document = $PHPWord->loadTemplate($templatePath);
        $document->setValue('type', htmlspecialchars("some value & foobar"));

=> why not add this htmlspecialchars right into the setValue function ?

Thanks for your feedback

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions