2016-09-12 7 views
0

중첩/하위 테이블을 PDFmake와 함께 사용하려면 어떻게해야합니까? 단순히 여러 테이블에 넣으려고했지만 페이지 나누기를 위해 최상위 테이블의 머리글을 자동으로 반복하지 않습니다.PDFMake가 포함 된 중첩/하위 테이블

답변

0

이 코드는 서브 테이블을 사용하는 단순화 된 예입니다. 그것은 pdfmake 놀이터의 테이블 섹션에서 수정되었습니다 (Google 검색을 통해 찾기가 쉽지 않음). http://pdfmake.org/playground.html

// playground requires you to assign document definition to a variable called dd 

var dd = { 
    content: [ 

       { text: 'A simple table with nested elements', style: 'subheader' }, 
       'It is of course possible to nest any other type of nodes available in pdfmake inside table cells', 
       { 
         style: 'tableExample', 
         table: { 
           headerRows: 1, 
           body: [ 
             ['Column 1', 'Column 2'], 
             [ 
               { 
                 stack: [ 
                   'Let\'s try an unordered list', 
                   { 
                     ul: [ 
                       'item 1', 
                       'item 2' 
                     ] 
                   } 
                 ] 
               }, 
               [ 
                'or a nested table', 
                { 
                 table: { 
                  body: [ 
                   [ 'Col1', 'Col2', 'Col3'], 
                   [ '1', '2', '3'], 
                   [ '1', '2', '3'] 
                  ] 
                 }, 
                } 
               ] 
             ] 
           ] 
         } 
       }, 

    ] 

} 
:

은에 다음을 붙여 넣기