Possible TReport problem with ::NeedNewPage()
Posted: Tue Oct 31, 2006 1:03 pm
Antonio,
I had a problem with occasionally getting a blank page printed out between other normal pages. So I took a close look at the way ::NeedNewPage() is implemented in TReport and found that ::nStdLineHeight gets added twice in immediate succession to ::nRow, and this seemed to be the source of my problem. Apparently it should have only been added once.
Here is how it happens...
1. In ::EndLine()...
DEFAULT nHeight := ::nStdLineHeight
::nRow += nHeight
IF ::NeedNewPage()
::EndPage()
ENDIF
2. In the definition of ::NeedNewPage()...
METHOD NeedNewPage INLINE ( ::nRow + ::nStdLineHeight >= ::nBottomRow )
Isn't the addition of ::nStdLineHeight in this method an unnecessary duplication of the addition of this same value immediately prior in ::EndLine() ?
Adding this value a second time sometimes pushes the value of ::nRow to a number greater than ::nBottomRow, even though the bottom of the page has actually not quite yet been reached, thereby forcing an ::EndPage() before it is actually needed.
- Roger
I had a problem with occasionally getting a blank page printed out between other normal pages. So I took a close look at the way ::NeedNewPage() is implemented in TReport and found that ::nStdLineHeight gets added twice in immediate succession to ::nRow, and this seemed to be the source of my problem. Apparently it should have only been added once.
Here is how it happens...
1. In ::EndLine()...
DEFAULT nHeight := ::nStdLineHeight
::nRow += nHeight
IF ::NeedNewPage()
::EndPage()
ENDIF
2. In the definition of ::NeedNewPage()...
METHOD NeedNewPage INLINE ( ::nRow + ::nStdLineHeight >= ::nBottomRow )
Isn't the addition of ::nStdLineHeight in this method an unnecessary duplication of the addition of this same value immediately prior in ::EndLine() ?
Adding this value a second time sometimes pushes the value of ::nRow to a number greater than ::nBottomRow, even though the bottom of the page has actually not quite yet been reached, thereby forcing an ::EndPage() before it is actually needed.
- Roger