Table Continuation - How do I mark rows as need repeating?

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v6)  /  Re: Table Continuation - How do I mark rows as need repeating?

DynamicPDF CoreSuite for .NET (v6) Forum

I may have difficulty explaining my request, but hopefully someone can help.

If I use the table continuation methodology to create a two table per page document (e.g. 1 primary table that spans the left hand column, then flips to the right hand column, then repeats this process on each page) is there a way to test for a condition for a row when I reach the bottom of one of the columns as in the example below?

Example:  All Caps text = Parent Row
          All lowercase text = child row

Currently how my table works:

PARENT 1               child 1
    child 1            child 2
    child 2        PARENT 3
    child 3            child 1
    child 4            child 2
PARENT 2  <--- Orphaned at bottom of page

What I would like to figure out how to do:

PARENT 1           PARENT 2   <----- Not orphaned
    child 1            child 1
    child 2            child 2
    child 3        PARENT 3
    child 4            child 1
                       child 2

I read somewhere that I can set the table height to adjust the number of rows the table will print per column, but how do I do that on a page by page and row by row basis using some logic checks?

Logic intended:

if ((parentRow.Height + currentYCoordinate) > PageHeight)
    <Move parentRow to next column>
    <Add parentRow to current column>

Is something like this possible within a do-while loop that simply grabs the overflow rows and adds them to the page?  Am I able to do any testing on the current rowset (or overflow rowset) to acheive the desired result?

Thank you for your time!
Posted by a ceTe Software moderator

The height of the overflow table can be changed based on a condition. Below is the sample code.
            Document document = new Document();
            Table2 table = new Table2(0, 0, 200, 400);
            Page page = null;
            bool addnewpage = true;
            for (int i = 1; i < 400; i++)
                Row2 row = table.Rows.Add(20);
                row.Cells.Add("Row #" + i);

                if (addnewpage)
                    page = new Page();
                    addnewpage = false;
                    table.X = 300;
                    addnewpage = true;

                table = table.GetOverflowRows();

                if (table != null)
                    table.X = 0;
                    if (document.Pages.Count == 2 || document.Pages.Count == 7)
                        table.Height = 700;
                        table.Height  = 400;

            } while (table != null);      

Regarding the condition to determine where the parent to row should be placed, you might be able to use GetVisibleRowCount() and other Table2 methods available to track if and when the parent row is orphaned you could decrease the height of the table so the orphaned parent row is moved to the overflow row set.
ceTe Software Support Team.
I have three tables in a page (33% height for each table). All the three tables should have same number of rows. For example: 3 rows. If the second table row height is more and cannot accommodate 3 rows, other 2 tables also should have only 2 rows. The remaining rows should go into overflow.
Posted by a ceTe Software moderator

You can achieve your requirements by tracking GetVisibleRowCount and altering the height of the tables.

In order to do this, you will have to track the visible rows of the 3 tables and get the minimum number of rows that can be displayed out of those 3 tables. Then set the height of the tables individually to the height required to display those number of rows by reducing the height in a loop till it display the minimum number of rows.

You can keep track of the visible rows for the given height of the table by using the GetVisibleRowCount() method of the Table2 class. Please send an email to our Support Team so that we can share a sample application that does this.

ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 11:10 PM.