Utilizing PHPdocX 6.5, with a minimally reproducible case being a bare document with a single template variable "bio-summaries"
$docx = new Phpdocx\Create\CreateDocxFromTemplate('./bioSummary.docx'); $stylesArray = array('<p>' => 'Normal', '<h1>' => 'Heading1', '<h2>' => 'Heading2'); $docx->replaceVariableByHTML('bio-summaries', 'block', "<strong>HELLO</strong> <em>world</em>! My name is <ul><li>First</li><li>Middle</li><li>Last</li></ul>", array( 'strictWordStyles' => FALSE, 'downloadImages' => TRUE, 'wordStyles' => $stylesArray, )); $docx->createDocx('result.docx');
Regardless of any of the three options being provided or not, TRUE or FALSE as well, every line has a leading space, and every bullet point has a leading space as well.
I have taken care to test it with a wrapper "<div>" and stripping out "/r" "/n" "/r/n", etc from the input as well, but to no avail.
If anyone could please assist in discerning the cause of the issue, it would be much appreciated.
Edit/Update:
It seems after further diving, that it's a problem with HTML2WordML's render functionality that renders each WordML token with a newline despite the input having no newline.