pdfmake icon indicating copy to clipboard operation
pdfmake copied to clipboard

nested tablet in a row span overflow other cells

Open Fableton opened this issue 6 years ago • 5 comments

Im triying to made a complex pdf and using tablet to ordenate my content

When I put a nested table inside a cell that have colSpan and rowSpan the cell on the rigtht tha have a colSpan too overflow the preview cell.

Image without colspan image

Image with colspan

image

Fableton avatar Feb 27 '19 00:02 Fableton

Attach example(s) runnable on playground for reproduce issue.

liborm85 avatar Feb 27 '19 06:02 liborm85

Working on the simplest issue I detect that the error is when there is more that 2 rows of separation between the cell a1 and the cell c3, to be more specific is the last row that have the problem.

TEMPORALY SOLUTION: I added a empty row with height 0;

This doesn't work :

var dd = {

	content: [
	    {
	    table: {
	        widths:[100,100,100,100,100],
	        heights:[100,100,100,100,100],
	        body:[
	            [{stack:[
	                'a1',
	                {
								table: {
							    widths:['30%',30,30],
							    	        heights:[100,100,50],

									body: [
										['Col1', 'Col2', 'Col3'],
										['1', '2', '3'],
										['1', '2', '3']
									]
								}
							}
	                ], fillColor: '#00a144',colSpan: 2 ,rowSpan:4},'a2','a3','a4','a5',],
	            ['b1','b2','b3','b4','b5',],
	             ['d1','d2','d3','d4','d5',],
	            ['c1','c2',{text:'c3', fillColor: '#458778',colSpan: 3 ,rowSpan:2},'c4','c5',],
	             ['e1','e2','e3','e4','e5',],
	             ]
	    }
	    }
	]
}

This Works

var dd = {

	content: [
	    {
	    table: {
	        widths:[100,100,100,100,100],
	        heights:[100,100,100,100,100],
	        body:[
	            [{stack:[
	                'a1',
	                {
								table: {
							    widths:['30%',30,30],
							    	        heights:[100,100,50],

									body: [
										['Col1', 'Col2', 'Col3'],
										['1', '2', '3'],
										['1', '2', '3']
									]
								}
							}
	                ], fillColor: '#00a144',colSpan: 2 ,rowSpan:4},'a2','a3','a4','a5',],
	            ['b1','b2','b3','b4','b5',],
	            ['c1','c2',{text:'c3', fillColor: '#458778',colSpan: 3 ,rowSpan:2},'c4','c5',],
	             ['d1','d2','d3','d4','d5',],
	             ['e1','e2','e3','e4','e5',],
	             ]
	    }
	    }
	]
}

Fableton avatar Feb 27 '19 15:02 Fableton

I have exactly the same problem: nested tables with rowspans do not flow to other rows unlike simple text which does flow across rows.

A table with rowspan cell contains another table with multiple row content, is restricted to only one (1) rows height and does not flow to other rows below.

Any news when bug will be fixed.

mutex12 avatar Aug 26 '19 01:08 mutex12

Also ran into this issue

Another sample

var dd = {
	"content": [
		{
            "table": {
                "body": [
                    [
                        {
                            "text": "Col. 2"
                        },
                        {
                            "rowSpan": 3,
                            "stack": [
                                {
                                    "table": {
                                        "widths": ["*", "auto"],
                                        "body": [
                                            [
                                                { "text": "COL A" },
                                                { "text": "COL B" }
                                            ],
                                            [
                                                { "text": "COL A" },
                                                { "text": "COL B" }
                                            ]
                                        ]
                                    }
                                }
                            ],
                        }
                    ],
                    [
                        {
                            "text": "Col. 4"
                        },
                        {
                            "text": "Col. 5"
                        }
                    ],
                    [
                        {
                            "text": "Col. 6"
                        },
                        {
                            "text": "Col. 7"
                        }
                    ]
                    
                ],
                "widths": [
                    "*",
                    "*"
                ]
            },
            "headerRows": 1
        }
     ]
};

Bene-Graham avatar Oct 24 '19 14:10 Bene-Graham

bump

kpetrow avatar Apr 24 '24 17:04 kpetrow

Fixed by PR https://github.com/bpampuch/pdfmake/pull/2764. Released in version 0.2.11.

liborm85 avatar Aug 09 '24 05:08 liborm85