Nested Tables

Nested Tables

Forum member · Jun 26, 2006
Does anyone have examples of using nested tables? I am trying to produce a document with two columns of data that read like a newspaper. It is for a parts listing that is long but very narrow so we can get to columns of data on each page to save the total number of pages. tks, vhb

Re: Nested Tables

Support · Jun 27, 2006
Hello, You can add any page elements inside the cell of the table without any problem. Look at the overloaded Add methods for the CellList class and also examples for each overloaded Add method in the Help Documentation. Following is the link to the Help Documentation on our web site that shows how to Add Page Elements to the cell of the table. Thanks, ceTe Software Support Team

Re: Nested Tables

Forum member · Jun 27, 2006
I'm still not getting it. I need to have a three column table print down the left side of the page then continue on the right side of the page. The data is coming from a datareader. The records need to flow down the left side, continue down the right side and then continue on to the next page the same way until all the records in the reader have been read. tks, vhb

Re: Nested Tables

Support · Jun 27, 2006
Hello, I see what you are saying. We have an example showing similar behavior. Please refer to the AllPageElements example downloaded with the product download and look at Page #2 which shows how to add table and overflow table side by side. Thanks, ceTe Software Support Team

Re: Nested Tables

Forum member · Jun 27, 2006
Ok, that is very helpful. I have the data looking the way I want but am having trouble getting it to flow to multiple pages. First page looks great but it stops there. I have tried the do loop while overflowtable is nothing but can't seem to get it to go past one page... tks, vhb

Re: Nested Tables

Forum member · Jun 27, 2006
Here is the code I am trying: Private Sub AddTable(ByVal itemReader As OleDbDataReader, ByVal X As Single, ByVal Y As Single) Dim cell As Cell Dim Cells As Integer = 3 Dim rowNum As Integer = 0 Dim i As Integer Dim myRow As Row Dim myCell As Cell Dim tableHeight As Integer Dim MyTable As Table Dim OverflowTable As Table Do objPage = New ceTe.DynamicPDF.Page MyTable = New Table(X, Y + 15, 280, 700, intCustomFont, 10) AddPageHeader(objPage.Elements, MyTable) While itemReader.Read myRow = MyTable.Rows.Add For i = 0 To Cells - 1 cell = myRow.Cells.Add(itemReader(i).ToString, intCustomFont, 8, RgbColor.Black, RgbColor.White, 1) Next End While ' Create an overflow table for the overflow columns OverflowTable = MyTable.GetOverflowRows(X + 275, Y + 15, 280, 700) If Not OverflowTable Is Nothing Then objPage.Elements.Add(MyTable) objPage.Elements.Add(OverflowTable) objDoc.Pages.Add(objPage) End If Loop While Not OverflowTable Is Nothing End Sub

Re: Nested Tables

Support · Jun 28, 2006
Hello, The problem is slightly in the logic you are using. Following is the modified code block: Dim MyDocument As New Document Dim MyTable As Table = New Table(0, 0, 200, 200, Font.TimesRoman, 10) MyTable.RepeatColumnHeaderCount = 1 MyTable.Columns.Add(70) MyTable.Columns.Add(70) MyTable.Columns.Add(30) Dim Row1 As Row = MyTable.Rows.Add(40, Font.HelveticaBold, 12, RgbColor.Black, RgbColor.LightBlue) For i As Integer = 0 To 2 Row1.Cells.Add("Header " & i) Next Dim Cell As Integer = 0 For j As Integer = 0 To 50 AddRow(MyTable, Cell, j.ToString) Next Dim MyOverflowTable As Table Do Dim MyPage As New ceTe.DynamicPDF.Page MyTable.X = 0 MyTable.Y = 0 MyPage.Elements.Add(MyTable) MyOverflowTable = MyTable.GetOverflowRows(250, 0) MyDocument.Pages.Add(MyPage) If Not MyOverflowTable Is Nothing Then MyPage.Elements.Add(MyOverflowTable) MyTable = MyOverflowTable.GetOverflowRows() Else Exit Do End If Loop Until MyTable Is Nothing MyDocument.DrawToWeb() Thanks, ceTe Software Support Team