Forum


Replies: 9   Views: 3752
Rtl lists generation from html
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by admin  · 12-12-2016 - 08:02

Hello,

We have tested the change proposed by the admin of the forum and it's working fine. After adding this code in the file HTML2WordML:

if ((isset($properties['dir']) && strtolower($properties['dir']) == 'rtl') ||
         (isset($properties['direction']) && strtolower($properties['direction']) == 'rtl')) {
            $stringListPr .= '<w:bidi w:val="1" />';
}

this code generates a RTL list in the DOCX ouput:

<?php

require_once 'classes/CreateDocx.inc';

$docx = new CreateDocx();
$docx->setRTL();

$html = '<ul>
            <li dir="rtl">One</li>
            <li dir="rtl">Two <b>and a half</b></li>
        </ul>';
$docx->embedHTML($html);

$docx->createDocx('output_rtl');

We have tested the output with MS Word 2007, MS Word 2013 and LibreOffice 5. Please try this code running it standalone and check that PHP Tidy is enabled and running on your server.

For futher support about this issue, please write to contact[at]phpdocx.com

Regards,
Phpdocx support team