Q&A

  • QuickReport에서 페이지 넘길때...
웹에서 파라메터로 String을 받아와서 쪼갠뒤 TStringList로 QRLabel에 하나씩 넣고자 합니다...

첫페이지에 3(0,1,2)개가 들어가고 두번째 페이지에 3(3,4,5)개가 들어가게 하고 싶은데

  SList := TStringList.Create;
  SList.Delimiter:='|';
  SList.DelimitedText:=Param1;

  lbl_p_code1.Caption := SList[1];
  lbl_p_code2.Caption := SList[2];
  lbl_p_code3.Caption := SList[3];
  lbl_p_code4.Caption := SList[4];
  lbl_p_code5.Caption := SList[5];

   DetailBand1.ForceNewPage:= true;
   (QuickRef.NewPage; 하니까 예기치 못한 호출이라면서 에러가 나더군여..ㅜㅜ)

  lbl_p_code1.Caption := SList[6];
  lbl_p_code2.Caption := SList[7];
  lbl_p_code3.Caption := SList[8];
  lbl_p_code4.Caption := SList[9];

이렇게 해보니 뒤에것만 보이고 1페이지만 나오네요...ㅜㅜ

앞에 페이지가 유지 되면서 뒤에 계속 2페이지 이상 추가할수 없을까요...ㅜㅜ



지금 이것때문에 몇일째 고생중...ㅜㅜ

델파이 초보가...ㅜㅜ
1  COMMENTS
  • Profile
    김병윤 2005.04.06 23:27
    이벤트를 어디서 사용하셨는지 모르겠네요...
    QuickRep1의 OnNeedData 이벤트를 사용해보세요

    <!--CodeS-->
    procedure TForm1.QuickRep1BeforePrint(Sender: TCustomQuickRep;
      var PrintReport: Boolean);
    begin
      pri_idx := 1;  // 인덱스 카운트
      pri_max := 2;// 최대 입력값

      // 값에 관한 부분은 BeforePrint나 레포트를 출력전에 외부에서 연산하시구요...
      SList := TStringList.Create;
      SList.Delimiter:='|';
      SList.DelimitedText:=Param1;
    end;

    procedure TForm1.QuickRep1NeedData(Sender: TObject; var MoreData: Boolean);
    begin
      if pri_idx <= pri_max then
      begin
        MoreData := True; // 추가 데이터가 있음
        DetailBand1.ForceNewPage := True;
      end
      else begin
        MoreData := False; // 추가 데이터가 없음
        DetailBand1.ForceNewPage := False;
      end;

      if pri_idx = 1 then
      begin
        lbl_p_code1.Caption := SList[1];
        lbl_p_code2.Caption := SList[2];
        lbl_p_code3.Caption := SList[3];
        lbl_p_code4.Caption := SList[4];
        lbl_p_code5.Caption := SList[5];
      end
      else begin
        lbl_p_code1.Caption := SList[6];
        lbl_p_code2.Caption := SList[7];
        lbl_p_code3.Caption := SList[8];
        lbl_p_code4.Caption := SList[9];
      end;

      Inc(pri_idx);
    end;

    <!--CodeE-->