-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
template replaceBlock() inserts text wrong in XML #316
Comments
Hi, |
I'm also have the same problem. I've tried to creating the template from:
All provided templates cause the issue when opening in Mac Word:
|
webadev@d825ff7 fixes the issue. @troosan is there a chance to get it merged into master in nearby future? |
@samdark @robov This is actually the way to do a blockReplace(). Each block in a separate line (so a paragraph)
And so you have a block, and you can This current, intended usage if blockReplace() is to, for example, grab a signature block (xml) from another document and insert it into our document, as The only case I can think about is having a default value of sorts:
with pseudo code:
or using it to delete a block without making the text below slide upwards due to a deleted element (similar to replacing all letters with whitespace to keep the formatting exact). What are your thoughts? |
The problem I had was the same as the initial poster.... hacking the code with the suggestion of Samdark fixed the issue. |
@robov can you test my code? TemplateProcessor.php with inline block support. This is a totally different approach (not xpathy but rposy) |
The method cloneBlock acceppts a integer as a second parameter. This parameter set the amount of times the block will be cloned.
It works. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
The |
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:
And after executing $document->replaceBlock('TP', 'THIS IS A SMALL TEST'); the result looks like this:
When I examine the XML, the replacement has taken place - it's 'just' placed outside the structure:
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.
The text was updated successfully, but these errors were encountered: