Hi--
I'm pulling data from a database and creating a two-column PDF using a table, but I need to protect against widows and orphans.
Is there a method to look at the last row placed in a column to check the contents and if it matches a certain criterium, be moved to the next?
:kevin
widow/orphans
Re: widow/orphans
Support · Feb 22, 2007Hello Kevin,
Yes, you Can take the rows of a table which do not fit in a single page to the next page without any problem. You will have to use the GetOverFlowRows method of the Table object, which returns the rows which does not fit in the given height of the table.
You can add this overflow table to the next page and you can do this in a loop until the overflow rows exists. You can refer to the Table Continuation
topic on our help documentation.
You can also know the text of a cell by using the Text property of the Cell class.
Thanks,
ceTe Software Support Team.
Re: widow/orphans
Forum member · Feb 22, 2007If I'm using the following loop to display the table, how would I look at the last row to fit to see if it is using HelveticaBold, for example, then move it to the next column?
If (Not tblParts Is Nothing) Then
'set X and Y to place the table on right side
tblParts.X = 260
tblParts.Y = 0
'add this table to the same page
pgParts.Elements.Add(tblParts)
'take the overflow to add to a new page
tblParts = tblParts.GetOverflowRows(0, 0, 440, 700)
End If
Loop While Not (tblParts Is Nothing)
Re: widow/orphans
Support · Feb 22, 2007Actually it looks like you do already understand the concept of the Table's text continuation (using the GetOverFlowRows method). This is what was being implied from the previous post that would ensure that any cells that did not fit on a previous page (or previous column) could overflow onto the next page (or next column).
There is not a good way however to check for specific text in the manner that you desire using the Table. It seems like however if you want to do this type of specific or customized logic that you could just do without the use of the Table object all together.
Without the Table object (by just placing Labels or TextAreas directly on the page) you would actually have complete control over the each and every piece of text that is being displayed. Using this method, you will just need to keep track of your X and Y location on the page as you are adding each label (or text area). In this case you could write any logic that you wanted to handle text at the end of a page and what to do with the text when deciding on whether to flow onto the next page.
Thanks,
ceTe Software Support Team
Re: widow/orphans
Forum member · Mar 1, 2007I suspected that would be the route to take and have this mostly coded.
I'm at the stage where I have the two columns appearing on one page, but after that what's the best method to add a new page page and start adding there?
Can I nest text areas and use the overflow?
Re: widow/orphans
Support · Mar 1, 2007To add a new page to the document all you would need to do is instantiate a new Page object and add it to the Document object using the Doucment's Page Collection's Add method. So for instance:
Dim MyPage As Page = New Page()
MyDocument.Pages.Add(MyPage)
Then you can just add any new content that you have to that new page.
Thanks,
ceTe Software Support Team
Re: widow/orphans
Forum member · Mar 6, 2007Hmm.... Having a spot of trouble adding pages.
I'm looping through an array, starting with the second item because I need to compare items to the one previous, and am not quite sure the best way to do this.
After forcing the first entry, I have this:
for i=1 to j-1
if y>=700 then
y=0
if column=1 then
column=2
x=x+260
else
column=1
x=0
'Dim MyPage as ceTe.DynamicPDF.Page = new ceTe.DynamicPDF.Page(dimensions)
MyDocument.Pages.Add(MyPage)
end if
end if
.
.
.
next
This produces 17 pages with all the content on every page. Uncommenting the new page line produces an error:
Variable 'MyPage' hides a variable in an enclosing block.
In the code contained in the for loop, I use:
MyPage.Elements.Add(MyTextArea)
to add each element. If I add a new page, defining MyPage2 as the new page, I can't continue using this loop. Should I nest the TextAreas and grab the overflow?
Thanks again for your help!
Re: widow/orphans
Support · Mar 6, 2007Hello,
You will have to declare the MyPage variable before starting the for loop as
Dim MyPage as ceTe.DynamicPDF.Page
and in the else statement you will have to create a new object for this MyPage.
MyPage = new ceTe.DynamicPDF.Page(dimensions)
Now this MyPage object will be accessible in the for loop after the else block also so that you can add MyTextArea to the MyPage without any problem.
Thanks,
ceTe Software Support Team.
Re: widow/orphans
Forum member · Mar 6, 2007D'oh!
Of course. Thank you for pointing out the obvious. ;)