如何讓報表依Memo資料來控制換頁?? |
尚未結案
|
TTS
初階會員 發表:72 回覆:66 積分:27 註冊:2003-05-06 發送簡訊給我 |
我的報表如下:
PageHeaderBand ↓ TitleBand ↓ Detail ↓ QRChildBand ↓ PageFooterBand Detail 上是沒有放任何元件的 且在BeforePrint 時 將 Height := 0 而我在QRChildBand 上放了一個QRMemo的元件 並在QRChildBand.BeforePrint時去控制 QRMemo 的值 並以QRMemo.Lines.Count 去控制QRChildBand的Height 現在我想以QRMemo.Lines.Count 來控制當筆數到達某固定筆數就將此報表換頁(NewPage) 但是試了幾個方式不過卻會造成錯誤(比方Mark的那段) 還請各位大大能指導一下!! [code delphi] procedure TAAA.ChildBand2BeforePrint(Sender: TQRCustomBand; var PrintBand: Boolean); begin SetItemPlace; end; procedure TAAA.SetItemPlace; const _ItemHeight = 18; _BandHieght = 5; var sStr: String; iCount, iItemCount, iLine: Integer; begin QRMemo2.Font.Name:= '細明體'; QRMemo2.Font.Size:= 10; QRMemo2.Font.Style:= [fsBold]; iCount:= 0; iItemCount:= 0; iLine:= 0; sStr:= ''; sItemAmt:= ''; QRShape17.Enabled:= False; QRMemo2.Lines.Clear; AData.First; try while Not AData.Eof do begin // if iItemCount >= 30 then // begin // iItemCount := 0; // QuickRep.NewPage; // end; sStr:= sStr AData.Item; Inc(iCount); Inc(iItemCount); if iCount >= 2 then begin QRMemo2.Lines.Add(sStr); Inc(iLine); iCount:= 0; sStr:= ''; end; AData.Next; end; if sStr <> '' then begin QRMemo2.Lines.Add(sStr); Inc(iLine); end; finally sItemAmt:= '共 ' IntToStr(iItemCount) ' 項, 價目 $' FloatToStr(ftAmt); end; QRMemo2.Height:= _ItemHeight; try if QRMemo2.Lines.Count > 1 then for iCount:= 1 to iLine - 1 do QRMemo2.Height:= QRMemo2.Height _ItemHeight; finally ChildBand2.Height:= QRMemo2.Top QRMemo2.Height _BandHieght; end; end; [/code] 編輯記錄
TTS 重新編輯於 2009-11-03 15:16:01, 註解 無‧
|
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |