This project is read-only.

Html to .docx (ol, li, p, span)

Nov 9, 2015 at 11:59 AM
Hello,
I'm using PHPWord to generate .docx words, from HTML.
I have the following situation:
<ol> <li>I'm directly inside the LI tag</li> <li><span>I'm directly inside the SPAN tag</span></li> <li><p><span>I'm directly inside the SPAN tag... SPAN is inside P tag</span></p></li> </ol> The content of the 2nd and 3rd LI, doesn't render. It shows a blank content in the .docx.

I tried render the SPAN tag changing the parseChildNodes():
$cNodes = $node->childNodes;
            if (count($cNodes) > 0) {
                foreach ($cNodes as $cNode) {              
                    // Added to get tables to work                    
                    $htmlContainers = array(
                        'span'
                        
                    );
                    if (in_array( $cNode->nodeName, $htmlContainers ) ) {                        
                        self::parseNode($cNode, $element, $styles, $data);
                    } else{                    
                        // All other containers as defined in AbstractContainer
                        if ($element instanceof AbstractContainer) {                        
                            self::parseNode($cNode, $element, $styles, $data);
                        }
                    }  
                }
            }