Question
“How can I draw a horizontal line after the last detail band on each page?”
Solution
The solution is to use the DetailBand AfterPrint event to track the page position and then use the Report EndPage event to add a DrawComamnd to the Page.
Download: LastDynamicDetailLine.zip
Sample Delphi code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
uses ppTypes, ppUtils, ppDrwCmd; procedure TForm1.ppReport1StartPage(Sender: TObject); begin // initialize for start of page FPosDetailBottom := -1; end; procedure TForm1.ppDetailBand1AfterPrint(Sender: TObject); begin // update print position FPosDetailBottom := ppReport1.Engine.PrintPosRect.Top; end; procedure TForm1.ppReport1EndPage(Sender: TObject); var lDrawLine: TppDrawLine; begin if (FPosDetailBottom <> -1) then begin // add DrawCommand to Page lDrawLine := TppDrawLine.Create(nil); lDrawLine.Page := ppReport1.Engine.Page; lDrawLine.LinePosition := lpTop; lDrawLine.Left := ppReport1.PrinterSetup.PageDef.mmMarginLeft; lDrawLine.Width := ppReport1.PrinterSetup.PageDef.mmPrintableWidth; lDrawLine.Top := FPosDetailBottom; end; end; |