@@ -784,4 +784,64 @@ public function testParseHorizRule()
784
784
$ this ->assertEquals (240 , $ doc ->getElement ($ xpath )->getAttribute ('w:line ' ));
785
785
}
786
786
787
+ /**
788
+ * Parse ordered list start & numbering style
789
+ */
790
+ public function testParseOrderedList ()
791
+ {
792
+ $ phpWord = new \PhpOffice \PhpWord \PhpWord ();
793
+ $ section = $ phpWord ->addSection ();
794
+
795
+ // borders & backgrounds are here just for better visual comparison
796
+ $ html = <<<HTML
797
+ <ol>
798
+ <li>standard ordered list line 1</li>
799
+ <li>standard ordered list line 2</li>
800
+ </ol>
801
+
802
+ <ol start="5" type="A">
803
+ <li>ordered list alphabetical, <span style="background-color: #EEEEEE; color: #FF0000;">line 5 => E</span></li>
804
+ <li>ordered list alphabetical, <span style="background-color: #EEEEEE; color: #FF0000;">line 6 => F</span></li>
805
+ </ol>
806
+
807
+ <ol start="3" type="i">
808
+ <li>ordered list roman lower, line <b>3 => iii</b></li>
809
+ <li>ordered list roman lower, line <b>4 => iv</b></li>
810
+ </ol>
811
+
812
+ HTML ;
813
+
814
+ Html::addHtml ($ section , $ html );
815
+ $ doc = TestHelperDOCX::getDocument ($ phpWord , 'Word2007 ' );
816
+
817
+ // compare numbering file
818
+ $ xmlFile = 'word/numbering.xml ' ;
819
+
820
+ // default - decimal start = 1
821
+ $ xpath = '/w:numbering/w:abstractNum[1]/w:lvl[1]/w:start ' ;
822
+ $ this ->assertTrue ($ doc ->elementExists ($ xpath , $ xmlFile ));
823
+ $ this ->assertEquals ('1 ' , $ doc ->getElement ($ xpath , $ xmlFile )->getAttribute ('w:val ' ));
824
+
825
+ $ xpath = '/w:numbering/w:abstractNum[1]/w:lvl[1]/w:numFmt ' ;
826
+ $ this ->assertTrue ($ doc ->elementExists ($ xpath , $ xmlFile ));
827
+ $ this ->assertEquals ('decimal ' , $ doc ->getElement ($ xpath , $ xmlFile )->getAttribute ('w:val ' ));
828
+
829
+ // second list - start = 5, type A = upperLetter
830
+ $ xpath = '/w:numbering/w:abstractNum[2]/w:lvl[1]/w:start ' ;
831
+ $ this ->assertTrue ($ doc ->elementExists ($ xpath , $ xmlFile ));
832
+ $ this ->assertEquals ('5 ' , $ doc ->getElement ($ xpath , $ xmlFile )->getAttribute ('w:val ' ));
833
+
834
+ $ xpath = '/w:numbering/w:abstractNum[2]/w:lvl[1]/w:numFmt ' ;
835
+ $ this ->assertTrue ($ doc ->elementExists ($ xpath , $ xmlFile ));
836
+ $ this ->assertEquals ('upperLetter ' , $ doc ->getElement ($ xpath , $ xmlFile )->getAttribute ('w:val ' ));
837
+
838
+ // third list - start = 3, type i = lowerRoman
839
+ $ xpath = '/w:numbering/w:abstractNum[3]/w:lvl[1]/w:start ' ;
840
+ $ this ->assertTrue ($ doc ->elementExists ($ xpath , $ xmlFile ));
841
+ $ this ->assertEquals ('3 ' , $ doc ->getElement ($ xpath , $ xmlFile )->getAttribute ('w:val ' ));
842
+
843
+ $ xpath = '/w:numbering/w:abstractNum[3]/w:lvl[1]/w:numFmt ' ;
844
+ $ this ->assertTrue ($ doc ->elementExists ($ xpath , $ xmlFile ));
845
+ $ this ->assertEquals ('lowerRoman ' , $ doc ->getElement ($ xpath , $ xmlFile )->getAttribute ('w:val ' ));
846
+ }
787
847
}
0 commit comments