Hi,
The sample overflow code provided assumes that the table will be starting using the full height of the page so that subsequent pages will start at the top.
I have a situation where my table is going to start on the initial page, say half way down, after a few initial elements and the continue over multiple pages. I then need to pick up inserting elemetns at the end of the table. Currently if my initial table position starts half way down the page then that is where it will start on all subsequent pages during the overflow - no good.
How can I start a table at an arbitraty position on the intial page, overflow on subsequent pages starting at the top of the page and then when the table is finished overflowing start inserting more elements directly underneath where the table finishes?
Thanks,
Leon.
Table Overflow Issue
Re: Table Overflow Issue
Support · Apr 27, 2009Hello Leon,
You can add the overflow table at any desired position without any problem using our DynamicPDF product. You will have to use the overloaded constructor of the GetOverflowRows mehtod which takes X and Y position coordinates. Please refer the documentation on GetOverflowRows
mehtod by clicking the link.
You can add the other page elements underneath the Table page element. You will have to keep track of the Y position and the height available on the page when adding a new page elements to prevent the elements from overlapping.
Thanks,
ceTe Software Support Team
Re: Table Overflow Issue
Forum member · Apr 27, 2009Hi,
Just to be clear I already own the product and have been using it happily for 6 months, this is a new requirement.
OK, so the process should be
Create the long table
Add it to the page whereever I want, i.e. half way down
[table rows stop at the bottom of the initial page on its own]
I call GetOverflowRows with overload (0,0) which causes the follow on pages to start at the top.
Let's say 5 pages are added - which property will give the bottom position of the table on the last page?
Thanks,
Leon.
Re: Table Overflow Issue
Support · Apr 27, 2009Hello Leon,
You can get the last page of the pdf document using the document.Pages[document.Pages.Count - 1] and you can get the height of the Table using the GetRequiredHeight mehtod. Then you will have to calculate the Y position for the other page element to add it below the Table page element. Below is the sample code for it.
tableHeight = table.GetRequiredHeight();
Page page = document.Pages[doc.Pages.Count - 1];
float yposition = tableHeight + 20;
page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("New Label", 100, yposition, 100, 20));
Thanks,
ceTe Software Support Team
Re: Table Overflow Issue
Forum member · May 12, 2009Here is the code I used to do this in case it helps anyone, it assumes that you will be adding the table on the first page.
You have to set the height of the table to the max height it could possibily be on the first page and then call the overflow row at 0,0
If anyone from CeTe thinks I am missing something please point it out!
objFirstPage.Elements.Add(objTable);
document.Pages.Add(objFirstPage);
if (objTable.GetOverflowRows(0, 0) != null)
{
do
{
Page page = new Page(objDimensions);
document.Pages.Add(page);
page.ApplyDocumentTemplate = false;
page.Elements.Add(objTable.GetOverflowRows(0, 0));
objTable = objTable.GetOverflowRows(0, 0);
} while (objTable.GetOverflowRows(0, 0) != null);
}
docTotalPages = document.Pages.Count;
Page objEndOfTablePage = document.Pages[docTotalPages - 1];
Re: Table Overflow Issue
Forum member · May 12, 2009// plus
HeightOfTableOnLastPage = objTable.GetRequiredHeight();
BottomOfTableOnLastPage = HeightOfTableOnLastPage + objTable.Y;
// then add your next element using BottomOfTableOnLastPage as starting point