Skip to content

template replaceBlock() inserts text wrong in XML #316

Open
@soren-bang

Description

@soren-bang

Greetings,

I have just recently started using PHPWord and up until now everything works as expected.

Using a simple document to test the template replaceBlock() function gives me a problem - it seems the text is inserted into the XML wrongly.

Template looks like this:

--- TP ---
${TP}

TEST

${/TP}
-- /TP ---

And after executing $document->replaceBlock('TP', 'THIS IS A SMALL TEST'); the result looks like this:

--- TP ---
-- /TP ---

When I examine the XML, the replacement has taken place - it's 'just' placed outside the structure:

<w:p w:rsidR="004F5777" w:rsidRDefault="005F5003">
<w:r>
<w:t>--- TP ---< /w:t>
</w:r>
</w:p>THIS IS A SMALL TEST< w:p w:rsidR="008A240D" w:rsidRDefault="005F5003">
<w:r>
<w:t>--- /TP ---< /w:t>
</w:r>
</w:p>

Am I being a knob and is doing something wrong or is it the code?

Thanks for listening!

:S:


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions