@@ -297,7 +297,7 @@ public function testParseTable()
297297 <thead>
298298 <tr style="background-color: #FF0000; text-align: center; color: #FFFFFF; font-weight: bold; ">
299299 <th style="width: 50pt">header a</th>
300- <th style="width: 50">header b</th>
300+ <th style="width: 50; border-color: #00EE00 ">header b</th>
301301 <th style="border-color: #00AA00 #00BB00 #00CC00 #00DD00; border-width: 3px">header c</th>
302302 </tr>
303303 </thead>
@@ -313,11 +313,17 @@ public function testParseTable()
313313 $ this ->assertTrue ($ doc ->elementExists ('/w:document/w:body/w:tbl/w:tr/w:tc ' ));
314314 $ this ->assertTrue ($ doc ->elementExists ('/w:document/w:body/w:tbl/w:tblPr/w:jc ' ));
315315 $ this ->assertEquals (Jc::START , $ doc ->getElementAttribute ('/w:document/w:body/w:tbl/w:tblPr/w:jc ' , 'w:val ' ));
316+
316317 //check border colors
317- $ this ->assertEquals ('#00AA00 ' , $ doc ->getElementAttribute ('/w:document/w:body/w:tbl/w:tr[1]/w:tc[3]/w:tcPr/w:tcBorders/w:top ' , 'w:color ' ));
318- $ this ->assertEquals ('#00BB00 ' , $ doc ->getElementAttribute ('/w:document/w:body/w:tbl/w:tr[1]/w:tc[3]/w:tcPr/w:tcBorders/w:right ' , 'w:color ' ));
319- $ this ->assertEquals ('#00CC00 ' , $ doc ->getElementAttribute ('/w:document/w:body/w:tbl/w:tr[1]/w:tc[3]/w:tcPr/w:tcBorders/w:bottom ' , 'w:color ' ));
320- $ this ->assertEquals ('#00DD00 ' , $ doc ->getElementAttribute ('/w:document/w:body/w:tbl/w:tr[1]/w:tc[3]/w:tcPr/w:tcBorders/w:left ' , 'w:color ' ));
318+ $ this ->assertEquals ('00EE00 ' , $ doc ->getElementAttribute ('/w:document/w:body/w:tbl/w:tr[1]/w:tc[2]/w:tcPr/w:tcBorders/w:top ' , 'w:color ' ));
319+ $ this ->assertEquals ('00EE00 ' , $ doc ->getElementAttribute ('/w:document/w:body/w:tbl/w:tr[1]/w:tc[2]/w:tcPr/w:tcBorders/w:right ' , 'w:color ' ));
320+ $ this ->assertEquals ('00EE00 ' , $ doc ->getElementAttribute ('/w:document/w:body/w:tbl/w:tr[1]/w:tc[2]/w:tcPr/w:tcBorders/w:bottom ' , 'w:color ' ));
321+ $ this ->assertEquals ('00EE00 ' , $ doc ->getElementAttribute ('/w:document/w:body/w:tbl/w:tr[1]/w:tc[2]/w:tcPr/w:tcBorders/w:left ' , 'w:color ' ));
322+
323+ $ this ->assertEquals ('00AA00 ' , $ doc ->getElementAttribute ('/w:document/w:body/w:tbl/w:tr[1]/w:tc[3]/w:tcPr/w:tcBorders/w:top ' , 'w:color ' ));
324+ $ this ->assertEquals ('00BB00 ' , $ doc ->getElementAttribute ('/w:document/w:body/w:tbl/w:tr[1]/w:tc[3]/w:tcPr/w:tcBorders/w:right ' , 'w:color ' ));
325+ $ this ->assertEquals ('00CC00 ' , $ doc ->getElementAttribute ('/w:document/w:body/w:tbl/w:tr[1]/w:tc[3]/w:tcPr/w:tcBorders/w:bottom ' , 'w:color ' ));
326+ $ this ->assertEquals ('00DD00 ' , $ doc ->getElementAttribute ('/w:document/w:body/w:tbl/w:tr[1]/w:tc[3]/w:tcPr/w:tcBorders/w:left ' , 'w:color ' ));
321327 }
322328
323329 /**
@@ -595,4 +601,35 @@ public function testParseMalformedStyleIsIgnored()
595601 $ doc = TestHelperDOCX::getDocument ($ phpWord , 'Word2007 ' );
596602 $ this ->assertFalse ($ doc ->elementExists ('/w:document/w:body/w:p[1]/w:pPr/w:jc ' ));
597603 }
604+
605+ /**
606+ * Tests parsing hidden text
607+ */
608+ public function testParseHiddenText ()
609+ {
610+ $ phpWord = new \PhpOffice \PhpWord \PhpWord ();
611+ $ section = $ phpWord ->addSection ();
612+ $ html = '<p style="display: hidden">This is some hidden text.</p> ' ;
613+ Html::addHtml ($ section , $ html );
614+
615+ $ doc = TestHelperDOCX::getDocument ($ phpWord , 'Word2007 ' );
616+
617+ $ this ->assertTrue ($ doc ->elementExists ('/w:document/w:body/w:p/w:r/w:rPr/w:vanish ' ));
618+ }
619+
620+ /**
621+ * Tests parsing letter spacing
622+ */
623+ public function testParseLetterSpacing ()
624+ {
625+ $ phpWord = new \PhpOffice \PhpWord \PhpWord ();
626+ $ section = $ phpWord ->addSection ();
627+ $ html = '<p style="letter-spacing: 150px">This is some text with letter spacing.</p> ' ;
628+ Html::addHtml ($ section , $ html );
629+
630+ $ doc = TestHelperDOCX::getDocument ($ phpWord , 'Word2007 ' );
631+
632+ $ this ->assertTrue ($ doc ->elementExists ('/w:document/w:body/w:p/w:r/w:rPr/w:spacing ' ));
633+ $ this ->assertEquals (150 * 15 , $ doc ->getElement ('/w:document/w:body/w:p/w:r/w:rPr/w:spacing ' )->getAttribute ('w:val ' ));
634+ }
598635}
0 commit comments