File tree Expand file tree Collapse file tree 5 files changed +56
-7
lines changed
itext.tests/itext.html2pdf.tests
resources/itext/html2pdf/element/TableTest
itext/itext.html2pdf/itext/html2pdf/attach/wrapelement Expand file tree Collapse file tree 5 files changed +56
-7
lines changed Original file line number Diff line number Diff line change @@ -410,6 +410,13 @@ public virtual void TableMaxHeightTest02() {
410410 RunTest ( "tableMaxHeight02" ) ;
411411 }
412412
413+ /// <exception cref="System.IO.IOException"/>
414+ /// <exception cref="System.Exception"/>
415+ [ NUnit . Framework . Test ]
416+ public virtual void MultipleRowsInHeade01 ( ) {
417+ RunTest ( "multipleRowsInHeader01" ) ;
418+ }
419+
413420 /// <exception cref="System.IO.IOException"/>
414421 /// <exception cref="System.Exception"/>
415422 [ NUnit . Framework . Test ]
Original file line number Diff line number Diff line change 1+ < html >
2+ < body >
3+ < table border ="1 ">
4+ < thead >
5+ < tr >
6+ < td > Header Row 1 Col 1</ td >
7+ </ tr >
8+ < tr >
9+ < td > Header Row 2 Col 1</ td >
10+ < td > Header Row 2 Col 2</ td >
11+ < td > Header Row 2 Col 3</ td >
12+ </ tr >
13+ </ thead >
14+ < tbody >
15+ < tr >
16+ < td > Body Row 1 Col 1</ td >
17+ </ tr >
18+ < tr >
19+ < td > Body Row 2 Col 1</ td >
20+ < td > Body Row 2 Col 2</ td >
21+ < td > Body Row 2 Col 3</ td >
22+ </ tr >
23+ </ tbody >
24+ < tfoot >
25+ < tr >
26+ < td > Footer Row 1 Col 1</ td >
27+ </ tr >
28+ < tr >
29+ < td > Footer Row 2 Col 1</ td >
30+ < td > Footer Row 2 Col 2</ td >
31+ < td > Footer Row 2 Col 3</ td >
32+ </ tr >
33+ </ tfoot >
34+ </ table >
35+ </ body >
36+ </ html >
Original file line number Diff line number Diff line change @@ -173,16 +173,22 @@ public virtual Table ToTable(WaitingColgroupsHelper colgroupsHelper) {
173173 table = new Table ( 1 ) ;
174174 }
175175 if ( headerRows != null ) {
176- foreach ( IList < TableWrapper . CellWrapper > headerRow in headerRows ) {
177- foreach ( TableWrapper . CellWrapper headerCell in headerRow ) {
178- table . AddHeaderCell ( headerCell . cell ) ;
176+ for ( int i = 0 ; i < headerRows . Count ; i ++ ) {
177+ for ( int j = 0 ; j < headerRows [ i ] . Count ; j ++ ) {
178+ table . AddHeaderCell ( headerRows [ i ] [ j ] . cell ) ;
179+ }
180+ if ( i != headerRows . Count - 1 ) {
181+ table . GetHeader ( ) . StartNewRow ( ) ;
179182 }
180183 }
181184 }
182185 if ( footerRows != null ) {
183- foreach ( IList < TableWrapper . CellWrapper > footerRow in footerRows ) {
184- foreach ( TableWrapper . CellWrapper footerCell in footerRow ) {
185- table . AddFooterCell ( footerCell . cell ) ;
186+ for ( int i = 0 ; i < footerRows . Count ; i ++ ) {
187+ for ( int j = 0 ; j < footerRows [ i ] . Count ; j ++ ) {
188+ table . AddFooterCell ( footerRows [ i ] [ j ] . cell ) ;
189+ }
190+ if ( i != footerRows . Count - 1 ) {
191+ table . GetFooter ( ) . StartNewRow ( ) ;
186192 }
187193 }
188194 }
Original file line number Diff line number Diff line change 1- 675a7c49c18ea91b941ce88da3f971266ca615c4
1+ 8e00c5ff051d0ba35eb920a636fda6dffc4c2b10
You can’t perform that action at this time.
0 commit comments