auto-pagebreak for frames

Knowledge exchange related to the VPE Report Engine and PDF Library

Moderator: IDEAL Software Support

auto-pagebreak for frames

Postby IDEAL Software Support » Thu Nov 18, 2004 7:57 pm

Hi

We are printing different forms with vpe. Is it possible to do a pagebreak automatically for a frame?

We use Box(x,y,x2,y2) to draw the frame. We can't use WriteBox(x,y, x2, vfree)to draw the frame, for sometimes the frame might be longer than the containing text.

Thanks in advance!
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

Postby IDEAL Software Support » Thu Nov 18, 2004 7:59 pm

Only Text objects and Rich Text objects break automatically over page boundaries. But breaking a frame yourself by code over multiple pages is rather an easy task.

Untested sample code, written from scratch (I'm not very familiar with Visual Basic, this code might contain some C/C++ things):

int first_page = VPE.CurrentPage
VPE.Write(x, y, width, VFREE, "very long text...")

' draw a frame on the last page around the text with 1 mm distance
VPE.Box(nLeft -10, nTop - 10, nRight + 10, nBottom + 10)

if first_page < > VPE.CurrentPage
' the last Write() caused a page break
' now draw a frame around the text on the initial page
int last_page = VPE.CurrentPage
VPE.CurrentPage = first_page
VPE.Box(nLeft -10, y - 10, nRight + 10, nBottomMargin + 10)

' In case the text was broken over multiple pages,
' draw frames around the text in the middle-pages
for i = first_page + 1 to last_page - 1
VPE.CurrentPage = i
VPE.Box(nLeft -10, nTopMargin - 10, nRight + 10, nBottomMargin + 10)
end for

' reposition on the last page
VPE.CurrentPage = last_page
end if


Regards
Thorsten Radde
IDEAL Software GmbH
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm


Return to VPE Open Forum

Who is online

Users browsing this forum: Google [Bot] and 8 guests