Nested Tables

Nested Tables

Forum member · Sep 18, 2007
The following code does not render a table inside the cell of another table. It is very simple. If I replace the part of the code where I place the table inside the cell with just plain text, then the full table renders, but as it is, only the first row renders. What am doing wrong? Dim MyTable as New ceTe.DynamicPDF.PageElements.Table(0, yLoc, MyPage.Dimensions.Body.Width, 100) MyTable.Columns.Add(MyPage.Dimensions.Body.Width * 0.5) MyTable.Columns.Add(MyPage.Dimensions.Body.Width * 0.5) MyTable.BorderWidth = 1 MyRow1 = MyTable.Rows.Add(12) MyRow1.Cells.Add("RGA Job Details", Font.HelveticaBold, 11, ceTe.DynamicPDF.CmykColor.Blue, ceTe.DynamicPDF.CmykColor.White, 1) MyRow1.Cells.Add("Notes", Font.HelveticaBold, 11, ceTe.DynamicPDF.CmykColor.Blue, ceTe.DynamicPDF.CmykColor.White, 1) Dim SubTable1 As New ceTe.DynamicPDF.PageElements.Table(0, 0, 200, 200) SubTable1.Columns.Add(100) SubTable1.Columns.Add(100) Dim SubRow1 As ceTe.DynamicPDF.PageElements.Row = SubTable1.Rows.Add(12) SubRow1.Cells.Add("Test") SubRow1.Cells.Add("Test 2") MyRow2 = MyTable.Rows.Add(50) MyRow2.Cells.Add(SubTable1) MyRow2.Cells.Add("Test2") MyPage.Elements.Add(MyTable)

Re: Nested Tables

Support · Sep 18, 2007
The problem is actually a simple logic mistake. You are attempting to nest a table (SubTable1) of height 200 into another table (MyTable) only of height 100. It won't fit. This explains why you are able to add two Rows of text (because two Rows of 12 points of height can easily fit into a table of height 100). But when you attempt to add your second row (SubRow1) containing a table of height 200 then this row will no longer fit inside your main table and is therefore not displayed. Even though you are setting the height of the second row (MyRow2) to 50, remember this is a minimum height. Any height specified in a Row constructor will automatically expands as you add elements to it. So when you add the Table (SubTable1) to the row it then expands the row height to 200 and no longer fits. The work around here is very simple and can be done one of two ways as follows: - Either increase the height of the outer table, MyTable (change your first line of code to something like below) Dim MyTable As New ceTe.DynamicPDF.PageElements.Table(0, 0, MyPage.Dimensions.Body.Width, MyPage.Dimensions.Body.Height) OR - Decrease the height of the nested SubTable1 (change the definition of SubTable1 to something like below) Dim SubTable1 As New ceTe.DynamicPDF.PageElements.Table(0, 0, 200, 20) Let us know if you have any further questions. Thanks, ceTe Software Support Team

Re: Nested Tables

Forum member · Sep 19, 2007
That was it. Thank you very much