document-builder icon indicating copy to clipboard operation
document-builder copied to clipboard

Problems nesting tables inside cells

Open ilmoralito opened this issue 8 years ago • 0 comments

Hello. I am trying to create a table with n rows where each row has two columns and each cell will contain a table.

If the table contains a single row i get what i am expecting

good

But if I add more rows the rows are overlapped

bad

This is the code i am trying

`PdfDocumentBuilder builder = new PdfDocumentBuilder(response.outputStream)

    builder.create {
        document {
            table {
                row {
                    cell {
                        table {
                            row {
                                cell 'cell1'
                                cell 'cell2'
                            }

                            row {
                                cell 'cell3'
                                cell 'cell4'
                            }
                        }
                    }

                    cell {
                        table {
                            row {
                                cell 'cell1'
                                cell 'cell2'
                            }

                            row {
                                cell 'cell3'
                                cell 'cell4'
                            }
                        }
                    }
                }

                row {
                    cell {
                        table {
                            row {
                                cell 'cell1'
                                cell 'cell2'
                            }

                            row {
                                cell 'cell3'
                                cell 'cell4'
                            }
                        }
                    }

                    cell {
                        table {
                            row {
                                cell 'cell1'
                                cell 'cell2'
                            }

                            row {
                                cell 'cell3'
                                cell 'cell4'
                            }
                        }
                    }
                }
            }
        }
    }   

    response.contentType = "application/pdf"
    response.setHeader("Content-disposition", "attachment;filename=printing.pdf")
    response.outputStream.flush()`

If i try with paragraphs inside cells instead of nested tables i get what i am expecting

wired

I am probably missing something. Thanks for any help

ilmoralito avatar Nov 10 '16 20:11 ilmoralito