Forum


Replies: 1   Views: 2023
Transformdocadvhtml and lists
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 IHD  · 27-01-2019 - 14:44

Hi, 

I'm using the TransformDocAdvHTML to transform a previously created docx to HTML. Consider the following word content: 

$itemList = array(
    'Line 1',
    array(
        'Line A',
        'Line B',
        'Line C'
    ),
    'Line 2',
    'Line 3',
);


$docx->addList($itemList, 2);
$docx->addText('ordinary text line');

When tranforming to HTML, it gives me a correct HTML structure, such as: 

<ol>
 <li>Line 1</li>
 <ol>
  <li>Line A</li>
  <li>Line B</li>
  <li>Line C</li>
 </ol>
 <li>Line 2</li>
 <li>Line 3</li>
<ol>
<p>ordinary text line</p>

 

HOWEVER, if the list ends with the nested list item, as follows:

$itemList = array(
    'Line 1',
    array(
        'Line A',
        'Line B',
        'Line C'
    ),
);


$docx->addList($itemList, 2);
$docx->addText('ordinary text line');

...then the <ol> tag is not closed properly and the resulting HTML looks like this:

<ol>
 <li>Line 1</li>
 <ol>
  <li>Line A</li>
  <li>Line B</li>
  <li>Line C</li>
 </ol>
 <p>ordinary text line</p>

 [AND ALL OTHER CONTENT ALSO SHOWS WITHIN THIS <ol> TAG]

<ol>

 

As you can see, the <p> tag and all other html comes before/within the closing </ol> tag. But it should come after.

Is there an easy "fix"?

Using version 8.0, advanced. 

Thanks!