You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the $template->setValue('AFTRA', htmlspecialchars("\nmyNewText") format to replace text in a table cell within a Word 2017 Template.
Template:
It should insert the text on the next new line, preserving existing formatting. so that it ends up like the following:
Current Behavior
In the resulting screenshot, you can see that while it put the new text on the next line, the justification of the previous line is distored.
Failure Information
Looking at the actual document.xml, it appears there is a discrepancy between what the Template Processor produces, and how Word itself handles line breaks.
Create a template with a table inside the document, add two template variables back to back as shown in above example. Replace first variable with text, replace second variable with a line break followed by more text.
Context
PHP version: 7.2
PHPWord version: v0.14.0
The text was updated successfully, but these errors were encountered:
This is:
Expected Behavior
Using the
![img](https://camo.githubusercontent.com/590651b9daa76c931909090b797b858f154a52e2ec67abd9eef694fab2d5e655/68747470733a2f2f692e696d6775722e636f6d2f51494b676d79592e706e67)
![correct](https://camo.githubusercontent.com/fa1e04ff586fe65111b6c5873c2b4c357a652d56719fff18c0bc36d226d53bd7/68747470733a2f2f692e696d6775722e636f6d2f7a587067626c4d2e706e67)
$template->setValue('AFTRA', htmlspecialchars("\nmyNewText")
format to replace text in a table cell within a Word 2017 Template.Template:
It should insert the text on the next new line, preserving existing formatting. so that it ends up like the following:
Current Behavior
In the resulting screenshot, you can see that while it put the new text on the next line, the justification of the previous line is distored.
![wrong formatting](https://camo.githubusercontent.com/eb1e2b2225dde361687226daf76815692e9d2c3df087b28d1b4fc95f383284d4/68747470733a2f2f692e696d6775722e636f6d2f714e796c3579662e706e67)
Failure Information
Looking at the actual
document.xml
, it appears there is a discrepancy between what the Template Processor produces, and how Word itself handles line breaks.Bad, Distorted Formatting
Correct formatting
How to Reproduce
Create a template with a table inside the document, add two template variables back to back as shown in above example. Replace first variable with text, replace second variable with a line break followed by more text.
Context
The text was updated successfully, but these errors were encountered: