Skip to content

Special Characters (ampersand) in Title break docx output #401

Closed
@jonnsn

Description

@jonnsn

Hi,

if you change Sample_17_TitleTOC.php to add a title including an &-sign

$section->addTitle('Foo & Bar', 1);

and select docx-Result the document won't open (tested in Word 2013):
"The file ____ cannot be opened because of problems with the contents"
Details: "Invalid char"
Position: [position of the ampersand in document.xml]

I did not test this with other characters but there might also be problems with ",',< and >

I found this post which might indicate the problem.
Escaping the character does not really help (see the StackOveflow-Thread linked above).

If I find some time I will try to solve this issue and make a patch, but I just wanted to note it down here already. Maybe someone has a note or already solved it somehow :-)

Regards

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions