GlenKPeterson / PdfLayoutManager

Adds line-breaking, page-breaking, tables, and styles to PDFBox
45 stars 20 forks source link

Nested tables in a cell #12

Open jeffschnellerEnvisa opened 8 years ago

jeffschnellerEnvisa commented 8 years ago

Is there a way to nest a table within a cell? How would one do this?

GlenKPeterson commented 8 years ago

I think so. A table is Renderable and a Cell can take a Renderable as it's contents.

jeffschnellerEnvisa commented 8 years ago

Great. That is what I assumed. The issue is that table requires the XyOffset in its builder. How do you determine the XyOffset of something inside of the cell that is part of a Table Row?

On May 25, 2016, at 7:25 AM, Glen K. Peterson notifications@github.com<mailto:notifications@github.com> wrote:

I think so. A table is Renderable and a Cell can take a Renderable as it's contents.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHubhttps://github.com/GlenKPeterson/PdfLayoutManager/issues/12#issuecomment-221545232

GlenKPeterson commented 8 years ago

Table nesting is really common in HTML. At one place I worked, they had a rule "don't nest more than 3 tables deep" but many people nested 5 or more tables deep. You shouldn't need to do that with PdfLayoutManager because you can declare different cell widths in different rows.

If you really need a nested table for some reason, I think you can get an XyOffset from a TablePart. After rendering the previous row, take the resulting Y-offset. You should already be able to calculate the x-offset in the current row because PdfLayoutManager gets that information from you.

I hope that helps!