Bharat_Naik wrote on May 21
st, 2008 at 5:06pm:
Is there a subroutine by using I can break a paragraph to have it properly distributed in the pages concerned? Am I making sense?
The subroutine below named PrintIt does what you are asking. The first six arguments are the same as PrintString. The last two are the Y position that you want the program to stop printing at and the Y Position you want the program to start printing at on the following page, If it wraps.
Subroutine MyNewPage()
Newpage(850, 1100)
End Subroutine
Subroutine PrintIt(vData as String, vX as Int, vY as Int, vWidth as Int, vFont as String, vFontSize as Int, vYWrap as Int, vStartY as Int)
Var vChunk as String
Var vChar as Char
Var vLen as Int
While @Len(vData) > 0
{
vChunk = ""
vChar = ""
PrintString(vData, vX, vY, vWidth, vFont, vFontSize, 1)
vLen = @Len(vData)
While (@PrintLastHeight() + vY) > vYWrap
{
If vChar <> "" Then
{
vChunk = vChar + vChunk
vLen = vLen - 1
vData = @Left(vData, vLen)
}
vChar = @Right(vData, 1)
While (vChar <> @Chr(32) And vChar <> @Chr(9) And vChar <> @Chr(10) And vChar <> @Chr(13))
{
vChunk = vChar + vChunk
vLen = vLen - 1
vData = @Left(vData, vLen)
vChar = @Right(vData, 1)
}
PrintString(vData, vX, vY, vWidth, vFont, vFontSize, 1)
}
PrintString(vData, vX, vY, vWidth, vFont, vFontSize, 0)
vY = vStartY
vData = vChunk
If vData <> "" Then
{
FinishPage()
MyNewPage()
}
}
End Subroutine
Below is an example of code to call it.
NewDocument(1)
MyNewPage()
PrintIt(Continent, 100, 900, 650, "BArial", 12, 1050, 50)
FinishPage()
FinishDocument()
If you need help understanding any part of the above code, just let me know and I'll be happy to explain it.
-Ray